Hello, in this Java programming video, we are going to take a look at numbers. So if you watch the date type video, if you haven't, I recommend going to it. And if you are sad, it's pretty cool. We cover numbers in there we cover like a one, two day types, you know, we cover integers love to belong, you know, all of that really cool stuff and I covered you know, the maximum value, the minimum value, how much memory it takes in memory, and that's all cool stuff. But you can do a lot more with numbers, especially when it comes to more like mathematical operations. And as a math library, you can just use it straight away.
So if let's say we create a let's create float called r equals 59.4 as a system And then, and then here, we're going to print out it normally. That's pretty cool. What we can do is actually round it. So we got common ground. So to round it, you just do math dot round, specify the value I. And if we were to run it, it ran the 259 forward method changes to 56.
So it's, you know, above the halfway mark. It now rounds it to a cool 60 grand. Yeah, pretty cool. We can also you know, do logarithms in here as well. So, we put system dot print ln, and then here, I'm going to put that I'm going to do math dot log. A lot there'll be no easy for me to figure out.
So if I do a log of two log of 100 should result in two. Hmm. Let me just think about it. So log me think about as so let me just open up a new window for log. Our hundred is to the potential. That's exactly okay.
So when you do login here is actually our base, E and if you want to print out e as well For lack of print out, you don't have to learn to do any, like so don't like, ah capitally when we're doing and then we have a obviously, you know, not all of those points couldn't just go on forever, but we got every moment to get what we, and I'm going to show you has to be powered now. So power system, dot out dot print ln. And in here, we are going to print map.pi. Well the result of map.pi. And this is a method that is part of the math class. And we're going to be covering methods on that.
I mean, we'll be covering method later on. So in here, first of all, you specify the base number. So let's say 10. And then we put to the result in 100 plus two squared. We can No SQL five then so you should have five zeros at the end of it, you know, cluding the decimal point 12345. Okay, that's really, really useful saves time having to do something like 10 1010 MCs already, you know, takes quite a bit of time maybe you have to do to like the power of 100 you know, says something crazy like the power of negative like some negative power, we would live in a whole number.
Better, we don't powers. You can also do square roots. We're not covering all of the different sort of number math functions that you can use up what a link with this video we can check them all out, but there are so many of them. Okay, so square root thing is system, dot out, dot print ln. And, for the map, sq root, sq RT and here before easy value We know it should be two. So it prints out two, which is all good stuff.
And I'll show you two more. I'll show you sign sign signatures on the system, dot out dot print ln. And in here, we are going to put math dot sine. And if we were to put, let's put zero, so this should result in zero. If we put pi and then our how accurate this will get 3.14159 pi should result in zero because it's not a whole value. It's like a very, very small bits Not quite, but what we can do is actually use pi.
So we could Simply put something like this, if we do double o equals math.pi. And we use PI here, you know, we could immediately just put math.pi there. But you don't want to complicate it too much by putting, you know, some sort of constant into a method called software to simplify the bail abstract. And if I run this now, we can, again, yeah, a very small number, it if you have true pi, it will be zero. But you're obviously losing precision here. And as a result, you will not get the value of you know the value that we want, which is zero if you were to complain that that's just you know, the unfortunate reality of it because we are losing precision.
That's something to bear in mind. And the last one I'm going to cover just you know, random so you can get some random number. So actually, you know what I covered quite a bit. And I'll show you the different function through though. No, you know? Yeah, so covered quite a lot.
I'm gonna leave you at next tech for you to implement the random, you know functionality in Java. Don't worry, I will provide a link to all the different methods that you can use for numbers. And thanks for watching. I'll be a link to the GitHub page with this video. And I look forward to seeing you in the next awesome video. Don't forget if you have questions, feel free to reach out