Example usage for java.util Locale US

List of usage examples for java.util Locale US

Introduction

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

Prototype

Locale US

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

Click Source Link

Document

Useful constant for country.

Usage

From source file:Main.java

public static String translateDecimal(int version) {
    return String.format(Locale.US, "%d.%d.%d.%d", version / 10000000, version / 100000 % 100,
            version / 10000 % 10, version % 10000);
}

From source file:Main.java

public static String formatPrice(String prefix, float value) {
    return String.format(Locale.US, prefix + "%.2f", value);
}

From source file:Main.java

public static String convertRelativeTimeTarget(int n) {
    n /= 1000;//  www . java 2  s.  c  o m
    return String.format(Locale.US, "%02d:%02d:%02d", n / 60 / 60, n / 60 % 60, n % 60);
}

From source file:Main.java

public static String formatFloat(float t) {
    try {// ww w.  j  a v  a 2  s .c o m
        return String.format(Locale.US, "%.1f", t);
    } catch (Exception e) {
        e.printStackTrace();
    }
    return "0.0";
}

From source file:Main.java

public static float roundFloatTwoHouse(float value) {

    return Float.parseFloat(String.format(Locale.US, "%.2f", value));
}

From source file:Main.java

public static void print(long value) {
    System.out.println(String.format(Locale.US, "$%,.2f", (double) value / 100));
}

From source file:Main.java

private static String formatKey(String name) {
    return name.toLowerCase(Locale.US);
}

From source file:Main.java

public static String formatInt(int number) {
    return NumberFormat.getNumberInstance(Locale.US).format(number);
}

From source file:Main.java

public static String getPercentString(float percent) {
    return String.format(Locale.US, "%d%%", (int) (percent * 100));
}

From source file:Main.java

public static String getPageFileName(int p) {
    NumberFormat nf = NumberFormat.getInstance(Locale.US);
    nf.setMinimumIntegerDigits(3);// w  w  w . j  av  a  2  s. co  m
    return "page" + nf.format(p) + ".png";
}