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:MainClass.java

public static void main(String[] args) throws NoSuchAlgorithmException {
    int numBytes = (new Integer("1111")).intValue();
    long seed = 01;
    if (args.length > 1)
        seed = (new Long("1111111111")).longValue();
    SecureRandom srand = SecureRandom.getInstance("SHA1PRNG");
    if (seed != 01)
        srand.setSeed(seed);//  ww w .  j  a v  a 2  s.c o  m
    byte[] bytes = new byte[numBytes];
    srand.nextBytes(bytes);
    System.out.println(new String(bytes));
}

From source file:Main.java

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

    arrayList.add(new Integer("1"));
    arrayList.add(new Integer("2"));
    arrayList.add(new Integer("3"));
    arrayList.add(new Integer("4"));
    arrayList.add(new Integer("5"));

    Object obj = Collections.min(arrayList);
    System.out.println(obj);//from  w ww.  ja  v a  2  s.com
}

From source file:Main.java

public static void main(String[] args) {

    ArrayList<Integer> arrayList = new ArrayList<Integer>();

    arrayList.add(new Integer("3"));
    arrayList.add(new Integer("1"));
    arrayList.add(new Integer("8"));
    arrayList.add(new Integer("3"));
    arrayList.add(new Integer("5"));

    Object obj = Collections.max(arrayList);
    System.out.println(obj);/*from  www .ja v a 2 s .c o m*/
}

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

    Iterator itr = lhashSet.iterator();

    while (itr.hasNext()) {
        System.out.println(itr.next());
    }//from  w  w w  . j  a va2s  . co m
}

From source file:ArrayListExample.java

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

    al.add(new Integer(1));
    al.add(new Integer(2));
    al.add(new Integer(3));
    al.add(new Integer(4));
    al.add(new Integer(5));
    al.add(new Integer(6));
    al.add(new Integer(7));
    al.add(new Integer(8));
    al.add(new Integer(9));
    al.add(new Integer(10));

    al.set(5, new Integer(66));

    for (Iterator i = al.iterator(); i.hasNext();) {
        Integer integer = (Integer) i.next();
        System.out.println(integer);
    }//ww  w. j  a v  a2 s.  c  o  m
}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    // Create a number spinner
    JSpinner spinner = new JSpinner();

    // Set its value
    spinner.setValue(new Integer(100));
}

From source file:Main.java

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

    // Create int wrapper object
    Integer refInt = new Integer(123);

    // Store int in map
    map.put("key", refInt);

    // Get int value from map
    refInt = (Integer) map.get("key");

    // Get the integer value from wrapper object
    int i = refInt.intValue();
}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    // Create a number spinner
    JSpinner spinner = new JSpinner();

    // Set its value
    spinner.setValue(new Integer(100));

    System.out.println(spinner.getValue());
}

From source file:Main.java

public static void main(String[] args) {
    TreeSet<Integer> tSet = new TreeSet<Integer>();
    System.out.println("Size of TreeSet : " + tSet.size());

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

    System.out.println(tSet.size());

    // remove one element from TreeSet using remove method

    tSet.remove(new Integer("1"));
    System.out.println("Size of TreeSet after removal : " + tSet.size());
}

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

    Provider provider = srand.getProvider();
    System.out.println(provider.getName());

    byte[] bytes = new byte[numBytes];
    srand.nextBytes(bytes);//from w  w w. jav a  2  s  . c om
    System.out.println(bytes);
}