List of usage examples for java.lang String format
public static String format(String format, Object... args)
From source file:Main.java
public static void main(String[] args) { String s = String.format("\\u%04x", (int) Character.MIN_LOW_SURROGATE); System.out.println(s);/*from w w w . j av a 2 s . c o m*/ }
From source file:Main.java
public static void main(String[] args) { String s = String.format("\\u%04x", (int) Character.MAX_LOW_SURROGATE); System.out.println(s);/*from www . j av a 2s .c om*/ }
From source file:Main.java
public static void main(String[] args) { String s = String.format("\\u%04x", (int) Character.MAX_VALUE); System.out.println(s);/*from ww w . jav a 2 s. c o m*/ }
From source file:Main.java
public static void main(String[] args) { String s = String.format("\\u%04x", (int) Character.MIN_VALUE); System.out.println(s);//from w ww . j a va 2s .c o m }
From source file:Main.java
public static void main(String[] args) { String s = String.format("\\u%04x", (int) Character.MAX_HIGH_SURROGATE); System.out.println(s);/*from ww w. j a v a 2s . c om*/ }
From source file:Main.java
public static void main(String[] args) { String s = String.format("\\u%04x", (int) Character.MIN_HIGH_SURROGATE); System.out.println(s);//ww w .j a va 2 s . c om }
From source file:Main.java
public static void main(String[] args) { int number = 1500; String formatted = String.format("%07d", number); System.out.println("Number with leading zeros: " + formatted); }
From source file:Main.java
public static void main(String[] args) { double value = 9.01236789E9; String text = String.format("%.0f", value); System.out.println(text); // 9012367890 NumberFormat format = NumberFormat.getNumberInstance(); format.setMaximumFractionDigits(0);//from w w w . j av a 2 s. c o m format.setGroupingUsed(false); System.out.println(format.format(value)); // 9012367890 }
From source file:Main.java
public static void main(String args[]) { Object a[] = { "String 1", "String 2", Calendar.getInstance() }; System.out.println(String.format("Hi %1$s at %2$s ( %3$tY %3$tm %3$te )", a)); }
From source file:Main.java
public static void main(String args[]) { System.out.printf("Hi %s at %s", "value", "value 2"); String a[] = { "value 1", "value 2" }; System.out.println(String.format("hi %s at %s", a)); }