Example usage for java.lang Integer valueOf

List of usage examples for java.lang Integer valueOf

Introduction

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

Prototype

@HotSpotIntrinsicCandidate
public static Integer valueOf(int i) 

Source Link

Document

Returns an Integer instance representing the specified int value.

Usage

From source file:Main.java

public static void main(String[] args) {
    System.out.println(Integer.valueOf("100"));
}

From source file:Main.java

public static void main(String args[]) {

    Integer i = Integer.valueOf("12345");

    System.out.println(i);
}

From source file:MainClass.java

public static void main(String[] arg) {
    System.out.println(Integer.valueOf("00900"));

}

From source file:Main.java

public static void main(String[] args) throws Exception {
    String str = "25";
    int i = Integer.valueOf(str).intValue();
    // or//from  www .ja va2s . c o  m
    i = Integer.parseInt(str);
}

From source file:Main.java

public static void main(String[] args) {
    Integer intObj = Integer.valueOf(100);

    // Gets byte from Integer
    byte b = intObj.byteValue();

    // Gets double from Integer
    double dd = intObj.doubleValue();
    System.out.println("intObj = " + intObj);
    System.out.println("byte from  intObj = " + b);
    System.out.println("double from  intObj = " + dd);

    // Creates a Double object
    Double doubleObj = Double.valueOf("123.45");

    // Gets different types of primitive values from Double
    double d = doubleObj.doubleValue();
    float f = doubleObj.floatValue();
    int i = doubleObj.intValue();
    long l = doubleObj.longValue();

    System.out.println("doubleObj = " + doubleObj);
    System.out.println("double from  doubleObj   = " + d);
    System.out.println("float from  doubleObj   = " + f);
    System.out.println("int from  doubleObj   = " + i);
    System.out.println("long from  doubleObj   = " + l);
}

From source file:Main.java

public static void main(String... args) {
    Converter<String, Integer> integerConverter1 = (from) -> Integer.valueOf(from);
    Integer converted1 = integerConverter1.convert("123");
    System.out.println(converted1); // result: 123

}

From source file:Main.java

public static void main(String[] args) {
    Integer intObj1 = new Integer("100");
    System.out.println(intObj1);//  w w w. j  av  a  2 s.c  o m

    String str = "100";
    Integer intObj2 = Integer.valueOf(str);
    System.out.println(intObj2);
}

From source file:MainClass.java

public static void main(String args[]) {

    Boolean bool = Boolean.valueOf("true");
    Character c = new Character('c');
    Byte b = Byte.valueOf("12");
    Short s = Short.valueOf("2");
    Integer i = Integer.valueOf("13245");
    Long l = Long.valueOf("12341234");
    Float f = Float.valueOf("11234.1234");
    Double d = Double.valueOf("43213241234.123412341234");

    System.out.println(bool);/*from   ww w .  j a v a  2 s .  c o  m*/
    System.out.println(c);
    System.out.println(b);
    System.out.println(s);
    System.out.println(i);
    System.out.println(l);
    System.out.println(f);
    System.out.println(d);
}

From source file:com.mycompany.gdp_service.Main.java

public static void main(String[] args) throws URISyntaxException {

    Integer port = Integer.valueOf(System.getenv("PORT"));

    URIBuilder builder = new URIBuilder();
    URI address = builder.setScheme("http").setPath("0.0.0.0").setPort(port).build();

    Endpoint.publish("http://0.0.0.0:" + port + "/gdp", new GDPImpl());
    Endpoint.publish("address", new GDPImpl());
}

From source file:net.socket.bio.TimeServer.java

/**
 * @param args// w ww. j  av  a  2 s.com
 * @throws IOException
 */
public static void main(String[] args) throws IOException {
    int port = 8089;
    if (args != null && args.length > 0) {

        try {
            port = Integer.valueOf(args[0]);
        } catch (NumberFormatException e) {
            // 
        }

    }
    ServerSocket server = null;
    try {
        server = new ServerSocket(port);
        System.out.println("The time server is start in port : " + port);
        Socket socket = null;
        while (true) {
            socket = server.accept();
            System.out.println("socket name" + socket);
            new Thread(new TimeServerHandler(socket)).start();
        }
    } finally {
        IOUtils.closeQuietly(server);
    }
}