Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

java add commas to numbers

String number = "1000500000.574";
double amount = Double.parseDouble(number);
DecimalFormat formatter = new DecimalFormat("#,###.00");
// the zeroes after the point are the number of digits shown after the period
// you can also switch point and commas and get for example 1.002,45
System.out.println(formatter.format(amount));
// this prints 1,000,500,000.57
Comment

PREVIOUS NEXT
Code Example
Java :: how to use edittext get 
Java :: reduce opacity of image in imageview in android 
Java :: SpEL define default 
Java :: hibernate dependency 
Java :: jframe add label java 
Java :: java measure execution time 
Java :: how to check type of primitive value in java 
Java :: java create list with initial elements 
Java :: How to connect java class file to xml file 
Java :: unit test java intellij 
Java :: java reverse value of boolean 
Java :: how to load font in java 
Java :: javax.xml.bind does not exist 
Java :: keytool error: java.lang.Exception: Keystore file does not exist: ~/.android/debug.keystore 
Java :: from string to double andoird studio 
Java :: simple yes no dialog android default java 
Java :: spring create bean only if another bean does not exists 
Java :: check if char is in char array java 
Java :: Why is it not recommended to use script elements in jsp? 
Java :: how to print the last element of an array 
Java :: pyramid star pattern in java 
Java :: java parse string to list using gson 
Java :: access each key and value in a hashmap java 
Java :: HOW TO SUPRESS sonar warning in java code 
Java :: Get the first Monday of a month in Java 
Java :: assertthat code throws exception 
Java :: alertdialog show in android 
Java :: how to iterate hashmap in java 
Java :: localdate to date java 
Java :: android studio float to int 
ADD CONTENT
Topic
Content
Source link
Name
1+7 =