Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

java round double to 2 decimals

double roundOff = Math.round(a * 100.0) / 100.0;
// Or
double roundOff = (double) Math.round(a * 100) / 100;
// both have the same output.
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #java #double #decimals
ADD COMMENT
Topic
Name
4+7 =