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:com.bdx.rainbow.service.jc.impl.DrugService.java

public static final void main(String[] arg) throws Exception {
    //      String json = "{"
    //               +"\"info\": {"
    //                   +"\"expired\": false, "
    //                   +"\"license_number\": \"?Z11020356\"," 
    //                    +"\"thumb_url\": \"\", "
    //                    +"\"last_time\": \"20150402\", "
    //                    +"\"flow\": \"????,\", "
    //                    +"\"pkg_spec\": \"10\", "
    //                    +"\"sale_time\": \"\", "
    //                    +"\"title\": \"??\", "
    //                    +"\"prepn_type\": \"\", "
    //                    +"\"query_time\": 15, "
    //                    +"\"prepn_unit\": \"\", "
    //                    +"\"pkg_unit\": \"\", "
    //                    +"\"issue_expiry\": \"20150811\", "
    //                    +"\"first_query\": \"20151106  094927\", "
    //                    +"\"is_sale\": false, "
    //                    +"\"retcode\": 0, "
    //                    +"\"last_ent\": \"??\", "
    //                    +"\"production_batch\": 13112522, "
    //                    +"\"status\": \"???????\", "
    //                    +"\"sale_ent\": \"\", "
    //                    +"\"code\": 8.120280038460442E19, "
    //                    +"\"production_date\": \"20130515\", "
    //                    +"\"specifications\": \"?5g\", "
    //                    +"\"category\": \"??\", "
    //                    +"\"manufacturer\": \"??????\", "
    //                    +"\"expiry_date\": \"20160430\""
    //                 +"}"
    //            +"}";
    //      //w  ww  . ja v  a  2 s  . c  o  m
    //      ObjectMapper mapper = new ObjectMapper();
    //      Map map = (Map)mapper.readValue(json, Map.class);
    //      Map infoMap = (Map)map.get("info");
    //      
    //   
    //      Drc   drc = new Drc();
    //         drc.setCategory((String)infoMap.get("license_number"));
    //         drc.setLastTime((String)infoMap.get("last_time"));
    //         drc.setFlow((String)infoMap.get("flow"));
    //         drc.setPkgSpec((String)infoMap.get("pkg_spec"));
    //         drc.setSaleTime((String)infoMap.get("sale_time"));
    //         drc.setTitle((String)infoMap.get("title"));
    //         drc.setPrepnType((String)infoMap.get("prepn_type"));
    //         drc.setPrepnUnit((String)infoMap.get("prepn_unit"));
    //         drc.setPkgUnit((String)infoMap.get("pkg_unit"));
    //         drc.setIssueExpiry((String)infoMap.get("issue_expiry"));
    //         drc.setFirstQuery((String)infoMap.get("first_query"));
    //         drc.setLastEnt((String)infoMap.get("last_ent"));
    //         drc.setProductionBatch((Integer)infoMap.get("production_batch")+"");
    ////         drc.setSt((String)infoMap.get("status"));
    ////         drc.set((String)infoMap.get("sale_ent"));
    //         drc.setJgmCode((Double)infoMap.get("code")+"");
    //         drc.setProductionBatch((String)infoMap.get("production_date"));
    //         drc.setSpecifications((String)infoMap.get("specifications"));
    //         drc.setCategory((String)infoMap.get("category"));
    //         drc.setManufacturer((String)infoMap.get("manufacturer"));
    //         drc.setExpiryDate((String)infoMap.get("expiry_date"));
    //         
    ////         81202800384604426739
    //         BigDecimal v = new BigDecimal((Double)infoMap.get("code"));
    //         
    //         System.out.println(v.toBigInteger());

    Integer i = new Integer(0);
    System.out.println(i.toString());

    //      System.out.println(mapper.writeValueAsString(drc));
}

From source file:Main.java

public static final Integer toInteger(String value) {
    try {/*  w ww .ja v  a  2s .  c  o  m*/
        return new Integer(value);
    } catch (Throwable t) {
        return null;
    }
}

From source file:Main.java

public static int sdkVersion() {
    return new Integer(Build.VERSION.SDK).intValue();
}

From source file:Main.java

public static void staticMethod() {
    // Creates an Integer object from an int
    Integer intObj1 = new Integer(100);

    // Creates an Integer object from a String
    Integer intObj2 = new Integer("1969");

    // Creates a Double object from a double
    Double doubleObj1 = new Double(10.45);

    // Creates a Double object from a String
    Double doubleObj2 = new Double("234.60");

    // Creates a Character object from a char
    Character charObj1 = new Character('A');

    // Creates a Boolean object from a boolean
    Boolean booleanObj1 = new Boolean(true);

    // Creates Boolean objects from Strings
    Boolean booleanTrue = new Boolean("true");
    Boolean booleanFalse = new Boolean("false");
}

From source file:Main.java

@SuppressLint("UseValueOf")
static public boolean isEmptyInt(int v) {
    Integer t = new Integer(v);
    return t == null ? true : false;
}

From source file:Main.java

public static byte[] Clear(byte[] ss) throws Exception {
    try {//from  w  w w .j  av  a2s  .c  om
        for (int m = 0; m < ss.length; m++) {
            ss[m] = new Integer(0).byteValue();
        }
        return ss;
    } catch (Exception e) {
        throw new Exception(e);
    }
}

From source file:Main.java

public static Object tagObj(String name) {
    if (tagIsInt(name))
        return new Integer(name);
    return name;//from w w w .  j av a  2  s .c o m
}

From source file:Main.java

public static void addIntValue(Map map, Object key, int value) {
    Object o = map.get(key);/*from   w  w w  . ja v  a 2  s  . co m*/
    if (o == null)
        map.put(key, new Integer(value));
    else
        map.put(key, new Integer(((Integer) o).intValue() + value));
}

From source file:Main.java

public static byte[] intToByte(int number) {
    int temp = number;
    byte[] b = new byte[4];
    for (int i = 0; i < b.length; i++) {
        b[i] = new Integer(temp & 0xff).byteValue();
        temp = temp >> 8;/* w  w w  .  ja v a 2s. c  om*/
    }
    return b;
}

From source file:Main.java

public static Integer[] toIntegerArray(int[] array) {
    Integer[] arr = new Integer[array.length];
    for (int i = 0; i < array.length; i++) {
        arr[i] = new Integer(array[i]);
    }// w  w w  .  ja  v a  2 s .  co m
    return arr;
}