About 13,400,000 results
Open links in new tab
  1. round up to 2 decimal places in java? - Stack Overflow

    Jul 28, 2012 · I have read a lot of stackoverflow questions but none seems to be working for me. i am using math.round () to round off. this is the code: class round { public static void main …

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

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

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

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

    Dec 19, 2012 · 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: double …

  6. 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; …

  7. How to convert an integer to bigdecimal in Java - Stack Overflow

    Apr 16, 2018 · I want to create a method that calculates multiplication of an integer and a bigdecimal. I search on Google and forums, but I didn't find anything. import …

  8. java.math.BigInteger cannot be cast to java.lang.Integer

    Mar 1, 2012 · java.math.BigInteger cannot be cast to java.lang.Integer Asked 13 years, 10 months ago Modified 7 years, 5 months ago Viewed 176k times

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

    Sep 30, 2008 · What I would like is a method to convert a double to a string which rounds using the half-up method - i.e. if the decimal to be rounded is 5, it always rounds up to the next …

  10. Combinatoric 'N choose R' in java math? - Stack Overflow

    Feb 5, 2010 · Is there a built in method in a java library that can compute 'N choose R' for any N, R?