Example usage for java.lang Integer toString

List of usage examples for java.lang Integer toString

Introduction

In this page you can find the example usage for java.lang Integer toString.

Prototype

@HotSpotIntrinsicCandidate
public static String toString(int i) 

Source Link

Document

Returns a String object representing the specified integer.

Usage

From source file:Main.java

public static void main(String[] args) {

    System.out.println(Integer.toString(10));

}

From source file:Main.java

public static void main(String[] args) {
    int i = 50;/*w  w  w  . j  a  va  2  s  .co m*/

    String str = Integer.toString(i);
    System.out.println(str + " : " + Integer.toString(i).getClass());

}

From source file:Main.java

public static void main(String[] args) throws Exception {
    int i = 2;//w w w .jav  a  2s  .  c  om
    String str = Integer.toString(i);
    System.out.println(str);
    // or
    str = "" + i;
    System.out.println(str);
}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    int i = Integer.parseInt("1023");
    String s = Integer.toString(i);
    System.out.println(s);//  w  ww . j a va 2  s  . c o m
}

From source file:Main.java

public static void main(String[] args) {
    IntFunction<String> i = (x) -> Integer.toString(x);

    System.out.println(i.apply(3).length());

}

From source file:Main.java

public static void main(String[] args) {
    Function<Integer, String> converter = (i) -> Integer.toString(i);

    System.out.println(converter.apply(3).length());
    System.out.println(converter.apply(30).length());
}

From source file:Main.java

public static void main(String[] args) {
    Function<Integer, String> converter = (i) -> Integer.toString(i);

    Function<String, Integer> reverse = (s) -> Integer.parseInt(s);

    System.out.println(converter.apply(3).length());
    System.out.println(converter.andThen(reverse).apply(30).byteValue());
}

From source file:Main.java

public static void main(String[] args) {
    Function<Integer, String> converter = (i) -> Integer.toString(i);

    Function<String, Integer> reverse = (s) -> Integer.parseInt(s);

    System.out.println(converter.apply(3).length());
    System.out.println(converter.compose(reverse).apply("30").length());
}

From source file:BigValueJOptionpaneDialog.java

public static void main(String[] a) {
    JFrame frame = new JFrame();
    String bigList[] = new String[30];

    for (int i = 0; i < bigList.length; i++) {
        bigList[i] = Integer.toString(i);
    }/* w ww  . j  a  v a 2 s  .c o  m*/

    JOptionPane.showInputDialog(frame, "Pick a printer", "Input", JOptionPane.QUESTION_MESSAGE, null, bigList,
            "Titan");

}

From source file:ImmutableStrings.java

public static void main(String[] args) {
    String foo = "foo";
    String s = "abc" + foo + "def" + Integer.toString(47);
    System.out.println(s);// w ww . j  ava2 s  . co m
    // The "equivalent" using StringBuffer:
    StringBuffer sb = new StringBuffer("abc"); // Creates String!
    sb.append(foo);
    sb.append("def"); // Creates String!
    sb.append(Integer.toString(47));
    System.out.println(sb);

}