#
Math Archive

In this post, we will see how to round double to 2 decimal places in java. There are many ways to do it.Let’s go through few ways. Math.round(double*100.0)/100.0 DecimalFormat(“###.##”) Let’s understand each with the help …

In this tutorial. we will see if how to get square root of number in java. It is very simple to get square root of number in java. You can simply use Math’s sqrt() method …

In this post, we will see how to convert String to BigDecimal in java. It is very simple to convert String to BigDecimal in java. You can simply use BigDecimal ‘s String based constructor to do …

In this post, we will see how to convert BigDecimal to String in java. There are many ways to convert BigDecimal to String in java.Some of them are: Using toString() Using String.valueOf() toString method You …

Power function in java is used to get first argument’s power to 2nd argument. For example: Let’s say you want to calculate 2 to the power 4. That will be 2*2*2*2=16 In java, you can …

In this post, we will see about Java math random example. Math’s random method provides you positive signed double value from 0.0 to 1.0. Syntax This method can be used in multithreaded environment as …

Java math floor function is used to get largest integer which is lesser than number. Syntax Example Let’s use math’s floor function in the example. When you run above program, output of the …

Java math ceil function is used to get smallest integer which is greater than number. Real life example Let’s say a telephone company charges you 1 dollar per minute. When you talk to someone for …