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 getMinutesOfWork(long startTime, long currentTime) {
    long timeSpent = currentTime - startTime;
    String timeSpentMinutes = String.valueOf(timeSpent / 60000);
    return Integer.valueOf(timeSpentMinutes);
}

From source file:Main.java

public static void putFloat(byte[] bb, float x, int index) {
    // byte[] b = new byte[4];
    int l = Float.floatToIntBits(x);
    for (int i = 0; i < 4; i++) {
        bb[index + i] = Integer.valueOf(l).byteValue();
        l = l >> 8;//from  ww w  . j a va 2s  . c  o  m
    }
}

From source file:Main.java

public static Integer getInteger(TypedArray a, int attr) {
    int value = a.getResourceId(attr, Integer.MAX_VALUE);
    return value == Integer.MAX_VALUE ? null : Integer.valueOf(value);
}

From source file:Main.java

private static int getVersionAsNumber(@NonNull String version) {
    version = version.replace(".", "");
    return Integer.valueOf(version);
}

From source file:Main.java

public static void putFloat(byte[] bb, float x, int index) {
    int l = Float.floatToIntBits(x);
    for (int i = 0; i < 4; i++) {
        bb[(index + i)] = Integer.valueOf(l).byteValue();
        l >>= 8;//from   w  w w  .  j a v  a2  s . c  om
    }
}

From source file:Main.java

public static int formatNum2Int(float v) {
    return Integer.valueOf(df_int.format(v));

}

From source file:Main.java

public static int[] stringToIntArray(String text) {
    String[] parts = text.split("\\s");
    int[] values = new int[parts.length];
    for (int i = 0; i < parts.length; i++) {
        values[i] = Integer.valueOf(parts[i]);
    }//from w ww  . j  a v  a2s .  c  om

    return values;
}

From source file:Main.java

public static int verEquals(String ver1, String ver2) {
    String[] ver1s = ver1.split("\\.");
    String[] ver2s = ver2.split("\\.");
    for (int i = 0; i < ver1s.length; ++i) {
        if (Integer.valueOf(ver1s[i]) > Integer.valueOf(ver2s[i])) {
            return 1;
        } else if (Integer.valueOf(ver1s[i]) < Integer.valueOf(ver2s[i])) {
            return -1;
        }/*from ww w.ja v  a 2  s  .c o  m*/
    }
    return 0;
}

From source file:Main.java

public static int getTextToInteger(String text) {
    if (TextUtils.isEmpty(text)) {
        return 0;
    } else if (TextUtils.isDigitsOnly(text)) {
        return Integer.valueOf(text);
    }/*  w  ww  .ja  va  2  s.  c om*/
    return 0;
}

From source file:Main.java

public static int getInt(EditText et) {
    String string = getString(et);
    if (string == null || string.length() == 0) {
        return 0;
    }/*from  w  w w. j a va2  s . co m*/
    return Integer.valueOf(getString(et));
}