Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

how to display the decimal value when 0 after point android studio

float price = 4.30;
// Choose the number of decimal places to work with in case they are different 
//than zero and zero value will be removed
DecimalFormat format = new DecimalFormat("0.##"); 
format.setRoundingMode(RoundingMode.DOWN); // Choose your Rounding Mode
System.out.println(format.format(price));
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #display #decimal #point #android #studio
ADD COMMENT
Topic
Name
4+9 =