Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package latihan30;
- import java.math.BigDecimal;
- import java.text.NumberFormat;
- import java.util.Locale;
- /**
- *
- * @author steven
- */
- public class Uang2 {
- public static void main(String[] args){
- Locale indonesiaLocale = new Locale.Builder().setLanguage("in").setRegion("ID").build();
- BigDecimal amount = new BigDecimal(1000);
- // Format jumlah uang dalam format US yg merupakan default
- NumberFormat defaultFormat = NumberFormat.getCurrencyInstance();
- System.out.println("US: " + defaultFormat.format(amount));
- // Format dalam Rp
- NumberFormat rupiahFormat = NumberFormat.getCurrencyInstance(indonesiaLocale);
- System.out.println("Indonesia: " + rupiahFormat.format(amount));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement