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) {
    LinkedHashSet<Integer> lhashSet = new LinkedHashSet<Integer>();

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

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

From source file:Main.java

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

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

    Object[] objArray = lhashSet.toArray();

    for (Object inte : objArray) {
        System.out.println(inte);
    }/*from w w  w  . j  a  v a2  s .c om*/
}

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"));

    Iterator itr = tSet.iterator();

    while (itr.hasNext()) {
        System.out.println(itr.next());
    }// w w w .j a  va  2  s. com
}

From source file:Main.java

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

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

    System.out.println(lhashSet);

    boolean blnRemoved = lhashSet.remove(new Integer("2"));

    System.out.println(blnRemoved);
    System.out.println(lhashSet);
}

From source file:Main.java

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

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

    System.out.println(lhashSet);

    lhashSet.clear();/*  ww w.  jav a  2 s.c  om*/

    System.out.println(lhashSet);

    System.out.println(lhashSet.isEmpty());
}

From source file:Main.java

public static void main(String[] args) throws NoSuchAlgorithmException {
    int numBytes = (new Integer("1111")).intValue();

    SecureRandom srand = new SecureRandom(new byte[] { 1, 2, 3, 4 });

    byte[] bytes = new byte[numBytes];
    srand.nextBytes(bytes);// w ww.j a  v a  2  s.  c  o  m
    System.out.println(new String(bytes));
}

From source file:Main.java

public static void main(String[] args) throws NoSuchAlgorithmException {
    int numBytes = (new Integer("1111")).intValue();

    SecureRandom srand = SecureRandom.getInstance("SHA1PRNG");
    srand.setSeed(new byte[] { 1, 2, 3, 4 });
    byte[] bytes = new byte[numBytes];
    srand.nextBytes(bytes);/*from   w w  w .j a v a  2s  .c o m*/
    System.out.println(new String(bytes));
}

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"));

    Iterator itr = hSet.iterator();

    while (itr.hasNext())
        System.out.println(itr.next());
}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    Map objMap = new IdentityHashMap();

    Object o1 = new Integer(123);
    Object o2 = new Integer(123);
    objMap.put(o1, "first");
    objMap.put(o2, "second");

    Object v1 = objMap.get(o1); // first
    Object v2 = objMap.get(o2); // second
}

From source file:Main.java

public static void main(String[] args) {
    LinkedHashMap<String, Integer> lHashMap = new LinkedHashMap<String, Integer>();

    lHashMap.put("One", new Integer(1));
    lHashMap.put("Two", new Integer(2));

    Object obj = lHashMap.get("One");
    System.out.println(obj);// ww w  .j a v a 2 s.  co  m
}