Advertisement
NestaRama

NumberFormat Lokasi Spesifik

Aug 24th, 2017
440
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 5 0.56 KB | None | 0 0
  1. package com.bahasaJava.numberFormat;
  2.  
  3. import java.text.NumberFormat;
  4. import java.util.Locale;
  5.  
  6. //bahasajava.com
  7. public class TestNumberFormat {
  8.    
  9.     public static void main(String[] args){
  10.        
  11.         double d = 3765.8745;
  12.        
  13.         String testFormat1 = NumberFormat.getInstance(Locale.US).format(d);
  14.         String testFormat2 = NumberFormat.getInstance(Locale.GERMAN).format(d);
  15.         String testFormat3 = NumberFormat.getInstance(Locale.FRENCH).format(d);
  16.         System.out.println("US:" + testFormat1 + "\n" + "GERMAN:" + testFormat2 + "\n" +
  17.                 "FRENCH: " + testFormat3);
  18.        
  19.     }
  20.  
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement