Convert integer to string

ReturnMethodSummary
StringtoString()Returns a String object representing this Integer's value.
static StringtoString(int i)Returns a String object representing the specified integer.
static StringtoString(int i, int radix)Returns a string representation of the first argument in the radix specified by the second argument.

public class Main {
  public static void main(String[] args) {

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

  }
}

The output:


10

To indicate the radix:


public class Main {
  public static void main(String[] args) {

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

  }
}

The output:


12
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.