About 10,700,000 results
Open links in new tab
  1. java - Round a double to 2 decimal places - Stack Overflow

    May 11, 2010 · 611 This question already has answers here: How to round a number to n decimal places in Java (40 answers)

  2. round up to 2 decimal places in java? - Stack Overflow

    Jul 28, 2012 · 296 This question already has answers here: How to round a number to n decimal places in Java (40 answers)

  3. Raising a number to a power in Java - Stack Overflow

    167 ^ in java does not mean to raise to a power. It means XOR. You can use java's Math.pow() And you might want to consider using double instead of int —that is:

  4. java - Math.random () explanation - Stack Overflow

    Nov 1, 2011 · This is a pretty simple Java (though probably applicable to all programming) question: Math.random() returns a number between zero and one. If I want to return an integer between zero …

  5. Rounding a double to turn it into an int (java) - Stack Overflow

    Consider using Math.toIntExact (long) instead of just casting to an int; a double can hold quite a range of values and you probably don't want to silently throw out the most significant bits if your double is …

  6. java - Calculating powers of integers - Stack Overflow

    Guava's math libraries offer two methods that are useful when calculating exact integer powers: pow(int b, int k) calculates b to the kth the power, and wraps on overflow checkedPow(int b, int k) is identical …

  7. modulo - What's the syntax for mod in Java? - Stack Overflow

    The answer calls the behavior of Java's remainder operator % (truncating towards zero) truncated modulo. It also lists a third variant, floored modulo, where the quotient is rounded towards negative …

  8. How to round a number to n decimal places in Java

    Sep 30, 2008 · How to round a number to n decimal places in Java Asked 17 years, 2 months ago Modified 1 year, 5 months ago Viewed 2.2m times

  9. java - How to use BigInteger? - Stack Overflow

    12 java.math.BigInteger is an immutable class so we can not assign new object in the location of already assigned object. But you can create new object to assign new value like:

  10. Java rounding up to an int using Math.ceil - Stack Overflow

    Aug 21, 2011 · I recommend using either option 1 or option 2. Please do NOT use option 0. Option 0 Convert a and b to a double, and you can use the division and Math.ceil as you wanted it to work. …