Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

Java currency format

double currencyAmount = 1500.00;
// Create a new Locale
Locale usa = new Locale("en", "US");
// Create a Currency instance for the Locale
Currency dollars = Currency.getInstance(usa);
// Create a formatter given the Locale
NumberFormat dollarFormat = NumberFormat.getCurrencyInstance(usa);

// Format the Number into a Currency String
System.out.println(dollars.getDisplayName() + ": " + dollarFormat.format(currencyAmount));
Comment

Currency Formatter java

NumberFormat numberFormat = NumberFormat.getCurrencyInstance(locale);
//the user may have selected a different currency than the default for their locale
Currency currency = Currency.getInstance("GBP");
numberFormat.setCurrency(currency);
numberFormat.format(amount);
Comment

PREVIOUS NEXT
Code Example
Java :: how to disable screenshot in react native 
Java :: spring security logging 
Java :: java how to know if there is something on arguments 
Java :: Java get integer color from rgb 
Java :: java run jar with args 
Java :: android convert date to local timezone 
Java :: how to find armstrong numbers in java 
Java :: interface extending interface in java 
Java :: java calendar 
Java :: how to convert errorBody to pojo in retrofit 
Java :: java break and continue 
Java :: How to summon an item in bukkit 
Java :: could not find java; set JAVA_HOME or ensure java is in PATH 
Java :: Implementing the ArrayList Class in java list 
Java :: kkkkkkkkkkkkkk 
Java :: finding length of arrays in java 
Java :: Describe Methods Overloading in Java 
Java :: java check if year is leap 
Java :: Exception in thread "main" java.lang.NoClassDefFoundError sdkmanager 
Java :: model mapper to list stream 
Java :: android java show hide keyboard in AndroidManifest 
Java :: jmeter set var jsr 
Java :: Java Create a LinkedHashSet 
Java :: char value java 
Java :: has been compiled by a more recent version of the Java Runtime (class file version 55.0) 
Java :: retrofit post body 
Java :: Java Find the greatest common divisor of two positive integers. The integers can be large, so you need to find a clever solution. 
Java :: UPLOAD TEXTFILE USING CYPERTEXT USING JAVA 
Java :: initialize empty dictionary java 
Java :: android studio check if email is valid java 
ADD CONTENT
Topic
Content
Source link
Name
8+2 =