Example usage for java.lang Integer Integer

List of usage examples for java.lang Integer Integer

Introduction

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

Prototype

@Deprecated(since = "9")
public Integer(String s) throws NumberFormatException 

Source Link

Document

Constructs a newly allocated Integer object that represents the int value indicated by the String parameter.

Usage

From source file:Main.java

public static void main(String[] args) {
    Integer integerObject = new Integer("1234567");

    short s = integerObject.shortValue();
    System.out.println("short:" + s);

}

From source file:MainClass.java

public static void main(String[] args) {
    int i = 17;/*from   ww w .j av a 2s. com*/
    Integer i2 = new Integer(i);
    System.out.println(i2.intValue());
}

From source file:Main.java

public static void main(String[] args) {
    int i = 10;//ww w .  j  a  v  a 2 s. co  m
    Integer intObj = new Integer(i);
    System.out.println(intObj);
}

From source file:Main.java

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

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

}

From source file:Main.java

public static void main(String[] args) {
    Integer intObj = new Integer("10");
    byte b = intObj.byteValue();
    System.out.println(b);/*from  w w  w . j a  v a 2 s . co m*/

    short s = intObj.shortValue();
    System.out.println(s);

    int i = intObj.intValue();
    System.out.println(i);

    float f = intObj.floatValue();
    System.out.println(f);

    double d = intObj.doubleValue();
    System.out.println(d);
}

From source file:Main.java

public static void main(String[] args) {
    // get a number as integer
    Number x = new Integer(123456);

    // get a number as float
    Number y = new Float(9876f);

    // print their value as byte
    System.out.println("x as integer:" + x + ", x as byte:" + x.byteValue());
    System.out.println("y as float:" + y + ", y as byte:" + y.byteValue());

}

From source file:Main.java

public static void main(String[] args) {

    // get a number as integer
    Number x = new Integer(123456);

    // get a number as double
    Number y = new Double(9876);

    // print their value as float
    System.out.println("x as integer:" + x + ", x as float:" + x.floatValue());
    System.out.println("y as double:" + y + ", y as float:" + y.floatValue());

}

From source file:Main.java

public static void main(String[] args) {

    // get a number as integer
    Number x = new Integer(123456);

    // get a number as float
    Number y = new Float(9876f);

    // print their value as double
    System.out.println("x as integer :" + x + ", x as double:" + x.doubleValue());
    System.out.println("y as float::" + y + ", y as double:" + x.doubleValue());

}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    Object[] items2 = { new Integer(123), new java.util.Date() };
    JList list = new JList(items2);

}

From source file:Main.java

public static void main(String[] argv) {

    String sValue = "5";

    try {/* www .  j  av a 2  s . c  o  m*/
        int iValue = new Integer(sValue).intValue();
    } catch (NumberFormatException ex) {
        ex.printStackTrace();
    }
}