About 164,000 results
Open links in new tab
  1. 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)

  2. How do I round a double to two decimal places in Java?

    You can't 'round a double to [any number of] decimal places', because doubles don't have decimal places. You can convert a double to a base-10 String with N decimal places, because base-10 does …

  3. integer - How to implement infinity in Java? - Stack Overflow

    Does Java have anything to represent infinity for every numerical data type? How is it implemented such that I can do mathematical operations with it? E.g. int myInf = infinity; //However it is d...

  4. 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)

  5. 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 …

  6. What does the ^ operator do in Java? - Stack Overflow

    Jan 2, 2010 · 7 It is the Bitwise xor operator in java which results 1 for different value of bit (ie 1 ^ 0 = 1) and 0 for same value of bit (ie 0 ^ 0 = 0) when a number is written in binary form. ex :- To use your …

  7. 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

  8. How do I generate random integers within a specific range in Java ...

    Java 7+ In Java 1.7 or later, the standard way to do this (generate a basic non-cryptographically secure random integer in the range ) is as follows:

  9. Getting random numbers in Java - Stack Overflow

    I would like to get a random value between 1 to 50 in Java. How may I do that with the help of Math.random();? How do I bound the values that Math.random() returns?

  10. Java: get greatest common divisor - Stack Overflow

    Oct 24, 2010 · I agree with your observation. GCD should a class with a bunch of overloaded static methods that takes in two numbers and gives it's gcd. And it should be part of the java.math package.