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

protected Object initialValue() {
    return new Integer(n--);
}

From source file:collection.java

public Object nextElement() {
    count++;
    if (count > 4)
        more = false;
    return new Integer(count);
}

From source file:Main.java

/** Transforms a two-dimensional array of primitives
 * to an array of Numbers.//from  w w  w.  j  av a  2 s.c o  m
 */
public static Number[][] transformArray(int[][] data) {
    Number[][] n = new Number[data.length][data[0].length];

    for (int i = 0; i < data.length; i++)
        for (int j = 0; j < data[0].length; j++)
            n[i][j] = new Integer(data[i][j]);

    return n;
}

From source file:Main.java

/**
 * Returns an attribute value as a Integer value.
 * @param attributes the Attributes object
 * @param name the name of the attribute
 * @return the attribute value as an Integer or null if the attribute is missing
 *//*  w  w  w .j  a  v  a2s.c o m*/
public static Integer getAttributeAsInteger(Attributes attributes, String name) {
    String s = attributes.getValue(name);
    if (s == null) {
        return null;
    } else {
        return new Integer(s);
    }
}

From source file:MyClass.java

public boolean myMethod(int p1, Object p2) {
    Logger logger = Logger.getLogger("com.mycompany.MyClass");
    if (logger.isLoggable(Level.FINER)) {
        logger.entering(this.getClass().getName(), "myMethod", new Object[] { new Integer(p1), p2 });
    }/* w w w . j  a v  a  2s.c  om*/

    System.out.println("Method body");

    boolean result = true;
    if (logger.isLoggable(Level.FINER)) {
        logger.exiting(this.getClass().getName(), "myMethod", new Boolean(result));
        logger.exiting(this.getClass().getName(), "myMethod");
    }
    return result;
}

From source file:net.sf.morph.util.TestClass.java

public static Map getEmptyMap() {
    Map map = new HashMap();
    map.put("anObject", null);
    map.put("myInteger", new Integer(0));
    map.put("myMap", null);
    map.put("myLongValue", null);
    map.put("array", null);
    map.put("numberArray", null);
    map.put("funkyArray", null);
    map.put("bigDecimal", null);
    map.put("string", null);
    return map;/*from   w w  w  . java2  s  .c o m*/
}

From source file:codeOrchestra.lcs.license.plimus.PlimusHelper.java

private static PlimusResponse executePlimusAction(String key, PlimusValidationAction action)
        throws IOException {
    GetMethod getMethod = new GetMethod(VALIDATION_URL);

    getMethod.getParams().setParameter("http.socket.timeout", new Integer(TIMEOUT));

    getMethod.setQueryString(new NameValuePair[] { new NameValuePair("action", action.name()),
            new NameValuePair("productId", PRODUCT_ID), new NameValuePair("key", key) });

    httpClient.executeMethod(getMethod);

    return new PlimusResponse(getMethod.getResponseBodyAsString());
}

From source file:com.mmone.gpdati.allotment.reader.AvailCrud.java

public static void saveAllotment(XmlRpcClient client, Integer hotelCode, java.util.Date startDt,
        java.util.Date endDt, Integer roomId, int bookingLimit) throws Exception {

    int iBookingLimit = new Integer(bookingLimit);

    int xrpcresult = modifyAllotment(client, startDt, endDt, AVAIL_ACTION_SET, iBookingLimit, 0, roomId,
            hotelCode);//from  www . j  a v  a  2  s .  c  o m
    Logger.getLogger("AvailCrud").log(Level.INFO, "xrpcresult=" + xrpcresult);

}

From source file:cz.muni.fi.pa165.creatures.rest.client.utils.DTOBuilder.java

public static AbstractDTO get(Class<?> clazz, CommandLine line) {
    if (clazz.equals(WeaponDTO.class)) {
        WeaponDTO dto = new WeaponDTO();
        if (line.hasOption("n")) {
            dto.setName(line.getOptionValue("n"));
        }/*from  w  w  w.  j  ava  2 s  . c om*/
        if (line.hasOption("m")) {
            dto.setAmmunition(new Integer(line.getOptionValue("m")));
        }
        if (line.hasOption("g")) {
            dto.setRange(new Integer(line.getOptionValue("g")));
        }
        if (line.hasOption("i")) {
            dto.setId(line.getOptionValue("i"));
        }
        return dto;
    } else if (clazz.equals(RegionDTO.class)) {
        RegionDTO dto = new RegionDTO();
        if (line.hasOption("n")) {
            dto.setName(line.getOptionValue("n"));
        }
        if (line.hasOption("d")) {
            dto.setDescription(line.getOptionValue("d"));
        }
        if (line.hasOption("a")) {
            dto.setArea(Long.parseLong(line.getOptionValue("a")));
        }
        if (line.hasOption("i")) {
            dto.setId(line.getOptionValue("i"));
        }
        return dto;
    } else {
        return null;
    }
}

From source file:MyBean.java

public void setMyProperty(int newValue) throws PropertyVetoException {
    try {/*from  w w w  .j  a  va2  s  .com*/
        vceListeners.fireVetoableChange("myProperty", new Integer(myProperty), new Integer(newValue));
        myProperty = newValue;
    } catch (PropertyVetoException e) {
        throw e;
    }
}