Example usage for java.util Locale GERMANY

List of usage examples for java.util Locale GERMANY

Introduction

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

Prototype

Locale GERMANY

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

Click Source Link

Document

Useful constant for country.

Usage

From source file:Main.java

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

    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[] argv) throws Exception {
    // Format/* w w w  . j ava  2  s.c  o m*/
    Locale locale = Locale.GERMANY;
    String string = NumberFormat.getCurrencyInstance(locale).format(123.45);

}

From source file:Main.java

public static void main(String[] argv) throws Exception {

    Number number = NumberFormat.getCurrencyInstance(Locale.GERMANY).parse("$123.45");
    if (number instanceof Long) {
        System.out.println("Long value");
    } else {//  w  ww.ja  v a  2s.  c  om
        System.out.println("Double value");
    }
}

From source file:Main.java

public static void main(String args[]) {

    // create a currency object with specified locale
    Locale locale = Locale.GERMANY;
    Currency curr = Currency.getInstance(locale);

    System.out.println("Locale's currency code:" + curr.getCurrencyCode());

}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    DecimalFormat format = new DecimalFormat();
    format.setCurrency(Currency.getInstance(Locale.GERMANY));
    System.out.println(format.clone());

}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    DecimalFormat format = new DecimalFormat();
    format.setCurrency(Currency.getInstance(Locale.GERMANY));
    System.out.println(format.getCurrency());

}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    DecimalFormat format = new DecimalFormat();
    format.setCurrency(Currency.getInstance(Locale.GERMANY));

    DecimalFormat format1 = new DecimalFormat();

    System.out.println(format1.equals(format));
}

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 v a  2 s. c o m
}

From source file:MainClass.java

public static void main(String args[]) throws Exception {
    NumberFormat numberFormat = NumberFormat.getInstance();
    numberFormat.setParseIntegerOnly(false);
    double usersNumber = 1976.0826;

    numberFormat = NumberFormat.getNumberInstance(Locale.GERMANY);
    System.out.println("User's number (GERMANY): " + numberFormat.format(usersNumber));

}

From source file:Main.java

public static void main(String[] argv) {
    NumberFormat numberFormat = NumberFormat.getInstance();
    numberFormat.setParseIntegerOnly(false);
    double usersNumber = 197912.29;

    numberFormat = NumberFormat.getNumberInstance(Locale.US);
    System.out.println("User's number (US): " + numberFormat.format(usersNumber));
    numberFormat = NumberFormat.getNumberInstance(Locale.GERMANY);
    System.out.println("User's number (GERMANY): " + numberFormat.format(usersNumber));
    numberFormat = NumberFormat.getNumberInstance();
    System.out.println("User's number (DEFAULT LOCALE): " + numberFormat.format(usersNumber));
}