Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

decimal format

public static final DecimalFormat df1 = new DecimalFormat( "#.##" );
public static final DecimalFormat df2 = new DecimalFormat( "#.00" );

System.out.println(df1.format(7.80));
System.out.println(df1.format(85));
System.out.println(df1.format(85.786));

System.out.println(df2.format(7.80));
System.out.println(df2.format(85));
System.out.println(df2.format(85.786));
Comment

decimal format

7.8
85
85.79

7.80
85.00
85.79
Comment

PREVIOUS NEXT
Code Example
Java :: Bukkit debug message 
Java :: java int to hex fixed length 
Java :: java popup message 
Java :: regex validation for special characters in java 
Java :: java get amount of enums 
Java :: toString convert to long 
Java :: How to efficiently find a target element in a sorted matrix of distinct ints, in Java? 
Java :: bloomreach remove property 
Java :: java initialize map with values in one line 
Java :: java create set with values 
Java :: java boilerplate 
Java :: android java remove action bar 
Java :: convert char to string java 
Java :: print 2d array in java 
Java :: java transform hashmap to list 
Java :: how to collect objective in java 
Java :: java normal constructor 
Java :: java get unix timestamp 
Java :: android elevation not working 
Java :: javafx change text size 
Java :: Convert Octal to Binary in java 
Java :: Lunar New Year 
Java :: java pause program until key pressed 
Java :: java get first 3 characters of string 
Java :: Java @Inherited 
Java :: java doreturn void 
Java :: Copying Arrays Using copyOfRange() method Java 
Java :: kotlin enable and disable parents view children 
Java :: system.out.println in java 
Java :: java random a-z 
ADD CONTENT
Topic
Content
Source link
Name
3+2 =