List of usage examples for java.lang String format
public static String format(Locale l, String format, Object... args)
From source file:Main.java
public static String formatFloat(float value) { return String.format(Locale.getDefault(), "%.3f", value); }
From source file:Main.java
public static String formatPrice(double price) { return String.format(Locale.getDefault(), "%.1f", price); }
From source file:Main.java
public static String formatAmount(double value) { return String.format(Locale.getDefault(), "%.2f", value); }
From source file:Main.java
public static String getCustomerId(String userId) { return String.format(Locale.CHINA, "u_%s", userId).toLowerCase(Locale.CHINA); }
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 miliSecondToString(long pTime) { int second = (int) (pTime / 1000); return String.format("%02d:%02d", second / 60, second % 60); }
From source file:Main.java
private static String getVersionSubdirectoryName(int version) { return String.format((Locale) null, "%s.ols%d.%d", new Object[] { "v2", Integer.valueOf(100), Integer.valueOf(version) }); }
From source file:Main.java
public static String formatFloat(float t) { try {/*from w w w . j av a 2s . 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 String milisecondsToMinuteString(long miliseconds) { return String.format("%d:%02d", TimeUnit.MILLISECONDS.toMinutes(miliseconds), TimeUnit.MILLISECONDS.toSeconds(miliseconds) - TimeUnit.MINUTES.toSeconds(TimeUnit.MILLISECONDS.toMinutes(miliseconds))); }