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

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

    Jul 28, 2012 · Decimal Format does not round off the last decimal value for any of its functions. The margin for the round off for all the functions is >5 but its supposed to be >4. Eg - 1.235 …

  3. How to round integer in java - Stack Overflow

    Apr 25, 2011 · 29 I want to round the number 1732 to the nearest ten, hundred and thousand. I tried with Math round functions, but it was written only for float and double. How to do this for …

  4. math - Java Round up Any Number - Stack Overflow

    I can't seem to find the answer I'm looking for regarding a simple question: how do I round up any number to the nearest int? For example, whenever the number is 0.2, 0.7, 0.2222, 0.4324, …

  5. java - How do I round to the nearest ten? - Stack Overflow

    Oct 3, 2016 · How can I round a number to the nearest ten with no if statements? For example, 98 to 100.

  6. How do I round a number in JavaScript? - Stack Overflow

    The Math.round () is most commonly used, it returns the value rounded to the nearest integer. Then there is the Math.floor () wich returns the largest integer less than or equal to a number. …

  7. Round down a number in java - Stack Overflow

    May 18, 2017 · I would like to know how I can instruct Java to always round down a given number. e.g.: 1.08 rounds to 1 1.56 rounds to 1 1.67 rounds to 1 1.98 rounds to 2 1.89 rounds …

  8. java - Round to nearest multiple of 5 (either up or down ... - Stack ...

    64 I need to round a number to nearest multiple of 5 (either up or down). For example, here are the list of numbers and the number next to it that it needs to round up/down to.

  9. java - Using Math.round to round to one decimal place? - Stack …

    Mar 5, 2014 · The Math.round method returns a long (or an int if you pass in a float), and Java's integer division is the culprit. Cast it back to a double, or use a double literal when dividing by 10.

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

    What did you expect? What errors did you got? Do you have a round() method in the same class? Did you import static java.lang.Math.*? Etc.. There are a lot of ways to round numbers and …