Example usage for java.util Locale JAPAN

List of usage examples for java.util Locale JAPAN

Introduction

In this page you can find the example usage for java.util Locale JAPAN.

Prototype

Locale JAPAN

To view the source code for java.util Locale JAPAN.

Click Source Link

Document

Useful constant for country.

Usage

From source file:Main.java

public static void main(String[] args) {
    Locale locale = Locale.JAPAN;

    System.out.println("Locale1:" + locale);

    // print the country of this locale
    System.out.println("Country:" + locale.getCountry());

}

From source file:Main.java

public static void main(String[] args) {
    Currency currency = Currency.getInstance(Locale.JAPAN);
    System.out.println("Currency.getSymbol() = " + currency.getSymbol());

    currency = Currency.getInstance(Locale.UK);
    System.out.println("Currency.getSymbol() = " + currency.getSymbol());

    currency = Currency.getInstance(Locale.US);
    System.out.println("Currency.getSymbol() = " + currency.getSymbol());

    currency = Currency.getInstance(new Locale("in", "ID"));
    System.out.println("Currency.getSymbol() = " + currency.getSymbol());
}

From source file:Main.java

public static void main(String[] args) throws Exception {
    Number number = NumberFormat.getNumberInstance(Locale.JAPAN).parse("25,000.75");
    if (number instanceof Long) {
        System.out.println("Long value: " + number.longValue());
    } else if (number instanceof Double) {
        System.out.println("Double value: " + number.doubleValue());
    }//from  www  .  ja va 2s .  c  o  m
}

From source file:FormatDateLocale.java

public static void main(String[] args) {
    Locale[] locales = new Locale[] { Locale.JAPAN, Locale.CHINA, Locale.KOREA, Locale.TAIWAN, Locale.ITALY,
            Locale.FRANCE, Locale.GERMAN };

    Date today = new Date();

    for (Locale locale : locales) {
        System.out.println("Date format in " + locale.getDisplayName() + " = "
                + SimpleDateFormat.getDateInstance(SimpleDateFormat.LONG, locale).format(today).toUpperCase());
    }/*  w  ww . j a va 2s  .co  m*/
}

From source file:TimeFormatDemo.java

public static void main(String args[]) {
    Date date = new Date();
    DateFormat df;/*from   w  w w  . j av a2  s . c  o  m*/

    df = DateFormat.getTimeInstance(DateFormat.SHORT, Locale.JAPAN);
    System.out.println("Japan: " + df.format(date));

    df = DateFormat.getTimeInstance(DateFormat.LONG, Locale.UK);
    System.out.println("United Kingdom: " + df.format(date));

    df = DateFormat.getTimeInstance(DateFormat.FULL, Locale.CANADA);
    System.out.println("Canada: " + df.format(date));
}

From source file:Test.java

public static void main(String[] args) {
    BigDecimal value = new BigDecimal(12345);
    Locale.setDefault(Locale.JAPAN);
    System.out.printf("Default locale: %s\n", Locale.getDefault().getDisplayName());
    NumberFormat nf = NumberFormat.getCurrencyInstance();
    String formattedCurrency = nf.format(value);
    System.out.printf("%s\n", formattedCurrency);
    nf.setCurrency(Currency.getInstance(Locale.US));
    formattedCurrency = nf.format(value);
    System.out.printf("%s\n\n", formattedCurrency);

    Locale.setDefault(Locale.US);
    System.out.printf("Default locale: %s\n", Locale.getDefault().getDisplayName());
    nf = NumberFormat.getCurrencyInstance();
    formattedCurrency = nf.format(value);
    System.out.printf("%s\n", formattedCurrency);
    nf.setCurrency(Currency.getInstance("JPY"));
    formattedCurrency = nf.format(value);
    System.out.printf("%s\n\n", formattedCurrency);

    Locale.setDefault(Locale.FRANCE);
    System.out.printf("Default locale: %s\n", Locale.getDefault().getDisplayName());
    nf = NumberFormat.getCurrencyInstance();
    formattedCurrency = nf.format(value);
    System.out.printf("%s\n", formattedCurrency);
    nf.setCurrency(Currency.getInstance("USD"));
    formattedCurrency = nf.format(value);
    System.out.printf("%s\n\n", formattedCurrency);
}

From source file:Main.java

public static void main(String[] args) {
    double value = 1234567.89;

    System.out.println("Unformatted: " + value + "\n");

    Locale locales[] = { Locale.US, Locale.FRANCE, Locale.GERMANY, Locale.JAPAN, new Locale("fr", "FR", "EURO"),
            new Locale("de", "DE", "EURO") };

    for (int i = 0; i < locales.length; i++) {
        NumberFormat nf = NumberFormat.getCurrencyInstance(locales[i]);

        System.out.println("Formatted for " + locales[i] + ": " + nf.format(value));
    }/*from  w  ww  .  j  a  va  2s.  c  o m*/
}

From source file:Main.java

public static void main(String[] args) throws Exception {
    NumberFormat formatter = NumberFormat.getNumberInstance(Locale.ITALY);
    String number = formatter.format(123456789.12);
    System.out.println("Number in Italy: " + number);
    formatter = NumberFormat.getNumberInstance(Locale.JAPAN);
    number = formatter.format(123456789.12);
    System.out.println("Number in Japan: " + number);
}

From source file:MainClass.java

public static void main(String args[]) {
    Date date = new Date();
    DateFormat df;//from  w  ww  .j a  v  a 2  s. co  m

    df = DateFormat.getDateInstance(DateFormat.SHORT, Locale.JAPAN);
    System.out.println("Japan: " + df.format(date));

    df = DateFormat.getDateInstance(DateFormat.MEDIUM, Locale.KOREA);
    System.out.println("Korea: " + df.format(date));

    df = DateFormat.getDateInstance(DateFormat.LONG, Locale.UK);
    System.out.println("United Kingdom: " + df.format(date));

    df = DateFormat.getDateInstance(DateFormat.FULL, Locale.US);
    System.out.println("United States: " + df.format(date));
}

From source file:Main.java

public static void main(String args[]) {
    int style = DateFormat.MEDIUM;
    // Also try with style = DateFormat.FULL and DateFormat.SHORT
    Date date = new Date();
    DateFormat df;//from  w w w . j a v  a2 s  . c  o  m
    df = DateFormat.getDateInstance(style, Locale.UK);
    System.out.println("United Kingdom: " + df.format(date));
    df = DateFormat.getDateInstance(style, Locale.US);
    System.out.println("USA: " + df.format(date));
    df = DateFormat.getDateInstance(style, Locale.FRANCE);
    System.out.println("France: " + df.format(date));
    df = DateFormat.getDateInstance(style, Locale.ITALY);
    System.out.println("Italy: " + df.format(date));
    df = DateFormat.getDateInstance(style, Locale.JAPAN);
    System.out.println("Japan: " + df.format(date));
}