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[] argv) throws Exception {
    Object[] params = new Object[] { new Integer(123), new Integer(1234) };
    String msg = MessageFormat.format("{0,number,#} a''s and {1,number,#} b''s", params);
    System.out.println(msg);//from ww w. java 2 s . c o  m
}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    Object[] params = new Object[] { new Integer(123), new Integer(1234) };
    String msg = MessageFormat.format("{0,number} a''s and {1,number} b''s", params);
    System.out.println(msg);/*from  ww  w  .  ja  v  a2 s. co  m*/
}

From source file:Main.java

public static void main(String[] argv) throws Exception {

    Object[] params = new Object[] { new Integer(123), new Integer(1234) };
    String msg = MessageFormat.format("{0} a''s and {1} b''s", params);
    System.out.println(msg);//from w w  w . j a v  a2  s . c o m
}

From source file:Main.java

public static void main(String[] args) {
    Function<String, Integer> stringToInt = x -> new Integer(x);

    int i = stringToInt.apply("1");
    System.out.println("String to integer: " + i);
}

From source file:MainClass.java

public static void main(String args[]) {
    Integer iobj1 = new Integer(5);
    Integer iobj2 = new Integer("6");
    int i1 = iobj1.intValue();
    int i2 = iobj2.intValue();
    System.out.println("i1 = " + i1);
    System.out.println("i2 = " + i2);
}

From source file:Main.java

public static void main(String[] args) {
    HashSet<Integer> hSet = new HashSet<Integer>();

    hSet.add(new Integer("1"));
    hSet.add(new Integer("2"));
    hSet.add(new Integer("3"));

    System.out.println(hSet.contains(new Integer("3")));
}

From source file:Main.java

public static void main(String[] args) {
    HashSet<Integer> hSet = new HashSet<Integer>();

    hSet.add(new Integer("1"));
    hSet.add(new Integer("2"));
    hSet.add(new Integer("3"));
    System.out.println("HashSet contains.." + hSet);

}

From source file:Main.java

public static void main(String[] args) {
    TreeSet<Integer> tSet = new TreeSet<Integer>();
    tSet.add(new Integer("1"));
    tSet.add(new Integer("2"));
    tSet.add(new Integer("3"));

    Object[] objArray = tSet.toArray();
    for (Object obj : objArray) {
        System.out.println(obj);//from  www.  j  av a  2 s .c  o m
    }
}

From source file:Main.java

public static void main(String[] args) {
    TreeSet<Integer> tSet = new TreeSet<Integer>();

    tSet.add(new Integer("1"));
    tSet.add(new Integer("2"));
    tSet.add(new Integer("3"));

    System.out.println(tSet);/*from   w w w. j  a v  a  2s.c om*/
    System.out.println("Was 2 removed from TreeSet ? " + tSet.remove(new Integer("2")));
    System.out.println(tSet);
}

From source file:Test.java

public static void main(String[] args) {
    ArrayList<Integer> a1 = new ArrayList<>();
    a1.add(new Integer(1));
    a1.add(2);//  w  ww  .ja  v a  2s  .c  o m
    ArrayList<Float> a2 = new ArrayList<>();
    a2.add(new Float(3.0));
    a2.add(new Float(4.0));
    displayElements(a1, a2, 12);

}