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

public static List<Integer> checkIdentical(List<Integer> list1, List<Integer> list2) {
    List<Integer> resultList = new ArrayList<Integer>();

    Iterator<Integer> iterator1 = list1.iterator();
    while (iterator1.hasNext()) {
        Integer next1 = iterator1.next();
        Iterator<Integer> iterator2 = list2.iterator();
        while (iterator2.hasNext()) {
            Integer next2 = iterator2.next();
            if (next1.intValue() == next2.intValue()) {
                iterator1.remove();//from w  ww.  ja va2  s. co m
                iterator2.remove();
                resultList.add(next1.intValue());
                break;
            }
        }
    }

    return resultList;
}

From source file:net.sourceforge.fenixedu.util.InquiriesUtil.java

public static String formatAnswer(final Integer answer) {
    int ans = answer.intValue();
    return ans > 0 ? String.valueOf(ans) : "-";
}

From source file:Main.java

@SuppressWarnings({ "rawtypes", "unchecked" })
public static Map getCardinalityMap(final Collection coll) {
    final Map count = new HashMap();
    for (final Iterator it = coll.iterator(); it.hasNext();) {
        final Object obj = it.next();
        final Integer c = (Integer) (count.get(obj));
        if (c == null) {
            count.put(obj, INTEGER_ONE);
        } else {//  ww  w. j  a  va 2 s.  co m
            count.put(obj, new Integer(c.intValue() + 1));
        }
    }
    return count;
}

From source file:com.mobileman.projecth.web.util.PatientUtils.java

static String computeGender(Integer gender) {
    String result = "";
    if (gender != null) {
        if (gender.intValue() == 0) {
            result = "Frau";
        } else {/*from  ww  w  .  j a  v  a  2s.c  o m*/
            result = "Herr";
        }
    }
    return result;
}

From source file:JavaUtils.java

/**
 * Utility to initialise the values of the JRE major/minor version.
 * Assumes the "java.version" string is in the form "XX.YY.ZZ".
 * Works for SUN JRE's./*  w  w w . j a  va2s  .  c o  m*/
 */
private static void initialiseJREVersion() {
    String version = System.getProperty("java.version");

    // Assume that the version string is of the form XX.YY.ZZ (works for SUN JREs)
    StringTokenizer tokeniser = new StringTokenizer(version, ".");
    String token = tokeniser.nextToken();
    try {
        Integer ver = new Integer(token);
        majorVersion = ver.intValue();

        token = tokeniser.nextToken();
        ver = new Integer(token);
        minorVersion = ver.intValue();
    } catch (Exception e) {
        // Do nothing
    }
    versionInitialised = true;
}

From source file:Main.java

public static Integer GG(Integer x, Integer y, Integer z, int j) throws Exception {
    if (j >= 0 && j <= 15) {
        return Integer.valueOf(x.intValue() ^ y.intValue() ^ z.intValue());
    } else if (j >= 16 && j <= 63) {
        return Integer.valueOf((x.intValue() & y.intValue()) | (~x.intValue() & z.intValue()));
    } else {/*w  w w .ja  va 2  s . c  o  m*/
        throw new Exception();
    }
}

From source file:Main.java

public static Integer FF(Integer x, Integer y, Integer z, int j) throws Exception {
    if (j >= 0 && j <= 15) {
        return Integer.valueOf(x.intValue() ^ y.intValue() ^ z.intValue());
    } else if (j >= 16 && j <= 63) {
        return Integer.valueOf(
                (x.intValue() & y.intValue()) | (x.intValue() & z.intValue()) | (y.intValue() & z.intValue()));
    } else {//from  ww  w.  ja va2s . c om
        throw new Exception();
    }
}

From source file:JavaUtils.java

/**
 * Check if the current version is greater or equals than the argument version.
 * @param version the version//from  w ww.  j  av a 2s.  c  o m
 * @return true if the runtime version is greater equals than the argument
 */
public static boolean isGreaterEqualsThan(String version) {
    boolean greaterEquals = false;
    StringTokenizer tokeniser = new StringTokenizer(version, ".");
    String token = tokeniser.nextToken();
    try {
        Integer ver = new Integer(token);
        int majorVersion = ver.intValue();

        token = tokeniser.nextToken();
        ver = new Integer(token);
        int minorVersion = ver.intValue();
        if (getJREMajorVersion() >= majorVersion && getJREMinorVersion() >= minorVersion) {
            greaterEquals = true;
        }
    } catch (Exception e) {
        // Do nothing
    }

    return greaterEquals;
}

From source file:JavaUtils.java

/**
 * Check if the current version is equals than the argument version.
 * @param version the version/*from  w w w  . j  a va2 s . c  om*/
 * @return true if the runtime version is equals than the argument
 */
public static boolean isEqualsThan(String version) {
    boolean equals = false;
    StringTokenizer tokeniser = new StringTokenizer(version, ".");
    String token = tokeniser.nextToken();
    try {
        Integer ver = new Integer(token);
        int majorVersion = ver.intValue();

        token = tokeniser.nextToken();
        ver = new Integer(token);
        int minorVersion = ver.intValue();
        if (getJREMajorVersion() == majorVersion && getJREMinorVersion() == minorVersion) {
            equals = true;
        }
    } catch (Exception e) {
        // Do nothing
    }

    return equals;
}

From source file:com.mobileman.projecth.web.util.PatientUtils.java

static String computeAvatar(Integer gender) {
    String result = "avatar_man";
    if (gender != null) {
        if (gender.intValue() == 0) {
            result = "avatar_woman";
        } else if (gender.intValue() == 1) {
            result = "avatar_man";
        } else {//ww  w  . j av  a 2  s.  c  om
            result = "avatar_man";
        }
    }
    return result;
}