Example usage for java.lang Integer intValue

List of usage examples for java.lang Integer intValue

Introduction

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

Prototype

@HotSpotIntrinsicCandidate
public int intValue() 

Source Link

Document

Returns the value of this Integer as an int .

Usage

From source file:MainClass.java

public static void main(String args[]) {
    Integer iOb = new Integer(100);

    int i = iOb.intValue();

    System.out.println(i);//from ww w .  j av a 2s .c  o  m
}

From source file:Wrap.java

public static void main(String args[]) {

    Integer iOb = new Integer(100);

    int i = iOb.intValue();

    System.out.println(i + " " + iOb); // displays 100 100
}

From source file:MainClass.java

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

From source file:Main.java

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

    int i = integerObject.intValue();
    System.out.println("int:" + i);

}

From source file:Main.java

public static void main(String[] args) {
    Integer[] arrayToSort = new Integer[] { new Integer(5), new Integer(89), new Integer(16), new Integer(2) };

    Arrays.sort(arrayToSort, Collections.reverseOrder());

    for (Integer i : arrayToSort) {
        System.out.println(i.intValue());
    }//w  w  w.ja v a2s.  c o  m
}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    Boolean refBoolean = new Boolean(true);
    boolean bool = refBoolean.booleanValue();

    Byte refByte = new Byte((byte) 123);
    byte b = refByte.byteValue();

    Character refChar = new Character('x');
    char c = refChar.charValue();

    Short refShort = new Short((short) 123);
    short s = refShort.shortValue();

    Integer refInt = new Integer(123);
    int i = refInt.intValue();

    Long refLong = new Long(123L);
    long l = refLong.longValue();

    Float refFloat = new Float(12.3F);
    float f = refFloat.floatValue();

    Double refDouble = new Double(12.3D);
    double d = refDouble.doubleValue();
}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    JToolBar toolbar = new JToolBar();
    toolbar.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
        public void propertyChange(java.beans.PropertyChangeEvent evt) {
            String propName = evt.getPropertyName();
            if ("orientation".equals(propName)) {
                Integer oldValue = (Integer) evt.getOldValue();
                Integer newValue = (Integer) evt.getNewValue();
                if (newValue.intValue() == JToolBar.HORIZONTAL) {
                    System.out.println("horizontal orientation");
                } else {
                    System.out.println("vertical orientation");
                }//from  ww  w  . j ava 2 s.c  o m
            }
        }
    });
}

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

public static void main(String[] args) {
    Object[][] data = { { "A", 5 }, { "B", 2 }, { "C", 4 }, { "D", 8 } };
    String columnNames[] = { "Item", "Value" };
    TableModel model = new DefaultTableModel(data, columnNames) {
        public Class<?> getColumnClass(int column) {
            return getValueAt(0, column).getClass();
        }/*from   w  w  w .  j a  v a2  s .  c  o m*/
    };
    JTable table = new JTable(model);

    RowFilter<Object, Object> filter = new RowFilter<Object, Object>() {
        public boolean include(Entry entry) {
            Integer population = (Integer) entry.getValue(1);
            return population.intValue() > 3;
        }
    };

    TableRowSorter<TableModel> sorter = new TableRowSorter<TableModel>(model);
    sorter.setRowFilter(filter);
    table.setRowSorter(sorter);
    JScrollPane scrollPane = new JScrollPane(table);
    JFrame frame = new JFrame("Filtering Table");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.add(scrollPane);
    frame.setSize(300, 200);
    frame.setVisible(true);
}

From source file:VectorBenchmark1.java

public static void main(String[] args) {
    Vector v = new Vector();

    long start = System.currentTimeMillis();
    for (int i = 0; i < MaxSize; i++)
        v.add(new Integer(i));
    long end = System.currentTimeMillis();
    System.out.println("Allocating vector elements: " + (end - start) + " milliseconds");

    Integer[] integerArray = new Integer[1];
    start = System.currentTimeMillis();
    for (int i = 0; i < MaxSize; i++) {
        if (i >= integerArray.length) {
            Integer[] b = new Integer[i * 2];
            System.arraycopy(integerArray, 0, b, 0, integerArray.length);
            integerArray = b;/*from  ww w .j a  v  a2s.  c om*/
        }
        integerArray[i] = new Integer(i);
    }
    end = System.currentTimeMillis();
    System.out.println("Allocating array elements:  " + (end - start) + " milliseconds");

    start = System.currentTimeMillis();
    for (int j = 0; j < NTRIES; j++)
        for (int i = 0; i < MaxSize; i++) {
            Integer r = (Integer) v.get(i);
            v.set(i, new Integer(r.intValue() + 1));
        }
    end = System.currentTimeMillis();
    System.out.println("Accessing vector elements:  " + (end - start) + " milliseconds");

    start = System.currentTimeMillis();
    for (int j = 0; j < NTRIES; j++)
        for (int i = 0; i < MaxSize; i++) {
            Integer r = integerArray[i];
            integerArray[i] = new Integer(r.intValue() + 1);
        }
    end = System.currentTimeMillis();
    System.out.println("Accessing array elements:   " + (end - start) + " milliseconds");
}