Advertisement
stevennathaniel

Format Persen Berhasil Menggunatakan Integer

Oct 29th, 2015
207
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.77 KB | None | 0 0
  1. /*
  2.  * To change this license header, choose License Headers in Project Properties.
  3.  * To change this template file, choose Tools | Templates
  4.  * and open the template in the editor.
  5.  */
  6. package latihan30;
  7.  
  8. import java.text.NumberFormat;
  9.  
  10. import java.util.Locale;
  11.  
  12. /**
  13.  *
  14.  * @author steven
  15.  */
  16. public class Persen1 {
  17.    
  18.     public static void main (String[] args){
  19.        
  20.         Locale indonesiaLocale = new Locale.Builder().setLanguage("in").setRegion("ID").build();
  21.        
  22.         int amount = 100;
  23.        
  24.         int amount2 = amount/100;
  25.        
  26.         NumberFormat persen = NumberFormat.getPercentInstance(indonesiaLocale);
  27.        
  28.         System.out.println("Indonesia Persen: " + persen.format(amount2));
  29.        
  30.        
  31.     }
  32.    
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement