Example usage for java.lang Integer valueOf

List of usage examples for java.lang Integer valueOf

Introduction

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

Prototype

@HotSpotIntrinsicCandidate
public static Integer valueOf(int i) 

Source Link

Document

Returns an Integer instance representing the specified int value.

Usage

From source file:Main.java

public static int getY(final Component component) {
    return component != null ? runInEDT(() -> Integer.valueOf(component.getY())).intValue() : 0;
}

From source file:Main.java

public static int getWidth(final Component component) {
    return component != null ? runInEDT(() -> Integer.valueOf(component.getWidth())).intValue() : 0;
}

From source file:Main.java

private static boolean modifyPermission(Context context, int flag) {
    String packageName = context.getPackageName();
    try {//from   w  w  w  . j av a2  s. co  m
        ContentValues contentValues = new ContentValues();
        contentValues.put("userAccept", Integer.valueOf(flag));
        context.getContentResolver().update(Uri.parse("content://com.lbe.security.miui.permmgr/active"),
                contentValues, "pkgName=?", new String[] { packageName });
        return true;
    } catch (Exception e) {
        e.printStackTrace();
        return false;
    }
}

From source file:com.yoncabt.ebr.executor.jasper.Convert.java

private static <T> T str2Number(String val, Class<T> valueClass) {
    if (StringUtils.isBlank(val)) {
        return null;
    }/*from   w  w  w. j  av a  2s  .  c  o m*/
    if (valueClass == Integer.class) {
        return (T) Integer.valueOf(val);
    }
    if (valueClass == Long.class) {
        return (T) Long.valueOf(val);
    }
    if (valueClass == Short.class) {
        return (T) Short.valueOf(val);
    }
    if (valueClass == Double.class) {
        return (T) Double.valueOf(val);
    }
    if (valueClass == BigDecimal.class) {
        return (T) new BigDecimal(val);
    }
    throw new IllegalArgumentException(val.getClass() + "->" + valueClass.getName());
}

From source file:Main.java

public static void addToMediaStorePlaylist(ContentResolver resolver, int audioId, long playlistId) {
    String[] cols = new String[] { "count(*)" };
    Uri uri = MediaStore.Audio.Playlists.Members.getContentUri("external", playlistId);
    Cursor cur = resolver.query(uri, cols, null, null, null);
    cur.moveToFirst();/*from w  ww. ja  v  a  2 s  .co  m*/
    final int base = cur.getInt(0);
    cur.close();
    ContentValues values = new ContentValues();
    values.put(MediaStore.Audio.Playlists.Members.PLAY_ORDER, Integer.valueOf(base + audioId));
    values.put(MediaStore.Audio.Playlists.Members.AUDIO_ID, audioId);
    resolver.insert(uri, values);

}

From source file:Main.java

public static long totalMemorySize() {
    String memInfoPath = "/proc/meminfo";
    String str2;/*  w w  w  . j a va 2  s.  co m*/
    String[] arrayOfString;
    long initial_memory = 0;
    try {
        FileReader localFileReader = new FileReader(memInfoPath);
        BufferedReader localBufferedReader = new BufferedReader(localFileReader, 8192);
        str2 = localBufferedReader.readLine();
        arrayOfString = str2.split("\\s+");
        for (String num : arrayOfString) {
            Log.i(str2, num + "\t");
        }
        //total Memory
        initial_memory = Integer.valueOf(arrayOfString[1]) * 1024;
        localBufferedReader.close();
        return initial_memory;
    } catch (IOException e) {
        return -1;
    }
}

From source file:Main.java

public static void add(Map<String, Integer> statMap, String key) {
    Integer counter = statMap.get(key);
    if (counter == null) {
        statMap.put(key, Integer.valueOf(1));
    } else {//from   ww  w  . j a  v a2  s .c o m
        statMap.put(key, Integer.valueOf(counter.intValue() + 1));
    }
}

From source file:Main.java

public static Transformer newTransformer(int indent) throws TransformerConfigurationException {
    TransformerFactory factory = newTransformerFactory();
    factory.setAttribute("indent-number", Integer.valueOf(indent));

    Transformer transformer = factory.newTransformer();
    transformer.setOutputProperty(OutputKeys.INDENT, "yes");

    return transformer;
}

From source file:ReplaceWorker.java

public void run() {
    for (int i = 0; i < 100; i++) {
        Integer putIfAbsent = Main.map.putIfAbsent("key", Integer.valueOf(1));
        if (putIfAbsent == null)
            return;
        Main.map.replace("key", putIfAbsent + 1);
    }//from   ww  w  . ja  v  a 2s  .c  o  m
}

From source file:Main.java

public static int getKlassenstufe(String klassenname) throws NumberFormatException {
    if (klassenname.isEmpty()) {
        return 0;
    }//from  ww w  .  j a  va  2s .co m
    String klassenstufe = klassenname.substring(0, 1);
    if (keineKlassenstufeEnthalten(klassenstufe)) {
        return 0;
    }
    if (klassenname.length() > 1) {
        if (Integer.valueOf(klassenstufe) == 1) {
            if (klassenname.substring(1, 2).equals("0")) {
                return Integer.valueOf(klassenname.substring(0, 2));
            }
        }
    }
    return Integer.valueOf(klassenstufe);
}