List of usage examples for java.lang String valueOf
public static String valueOf(double d)
From source file:Main.java
public static void main(String args[]) { boolean booleanValue = true; System.out.printf("boolean = %s\n", String.valueOf(booleanValue)); }
From source file:Main.java
public static void main(String[] argv) throws Exception { // Use String.valueOf() String s = String.valueOf(true); s = String.valueOf((byte) 0x11); s = String.valueOf((byte) 0xFF); s = String.valueOf('a'); s = String.valueOf((short) 123); s = String.valueOf(123);// w w w . j a v a 2s . c om s = String.valueOf(123L); s = String.valueOf(1.23F); s = String.valueOf(1.23D); // Use + s = "" + true; s = "" + ((byte) 0x12); s = "" + ((byte) 0xFF); s = "" + 'a'; s = "" + ((short) 123); s = "" + 111; s = "" + 111L; s = "" + 1.11F; s = "" + 1.11D; }
From source file:Main.java
public static void main(String[] args) { char[] data = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j' }; String text = String.valueOf(data); System.out.println(text);/*from w w w. ja va 2 s .co m*/ text = String.copyValueOf(data, 3, 5); System.out.println(text); }
From source file:Main.java
public static void main(String args[]) { long longValue = 10000000000L; // L suffix indicates long System.out.printf("long = %s\n", String.valueOf(longValue)); }
From source file:Main.java
public static void main(String args[]) { double doubleValue = 3.3; // no suffix, double is default System.out.printf("double = %s\n", String.valueOf(doubleValue)); }
From source file:Main.java
public static void main(String args[]) { float floatValue = 2.5f; // f indicates that 2.5 is a float System.out.printf("float = %s\n", String.valueOf(floatValue)); }
From source file:Main.java
public static void main(String[] args) { Arrays.asList(1, 20, 40, 4).stream().filter(n -> n < 30).map(n -> "number: " + String.valueOf(n)) .forEach(n -> System.out.println(n)); }
From source file:Main.java
public static void main(String args[]) { Object objectRef = "hello"; // assign string to an Object reference System.out.printf("Object = %s\n", String.valueOf(objectRef)); }
From source file:Main.java
public static void main(String args[]) { char charArray[] = { 'j', 'a', 'v', 'a', '2', 's', '.', 'c', 'o', 'm' }; System.out.printf("char array = %s\n", String.valueOf(charArray)); }
From source file:Main.java
public static void main(String[] args) { MyEnum enum1 = MyEnum.Choice1; System.out.println("enum1==>" + String.valueOf(enum1)); MyEnum enum2 = MyEnum.getByValue(enum1.getValue()); System.out.println("enum2==>" + String.valueOf(enum2)); MyEnum enum3 = MyEnum.getByValue(4); System.out.println("enum3==>" + String.valueOf(enum3)); }