List of usage examples for java.lang Integer valueOf
@HotSpotIntrinsicCandidate public static Integer valueOf(int i)
From source file:Main.java
public final static int convertToInt(Object value, int defaultValue) { if (value == null || "".equals(value.toString().trim())) { return defaultValue; }//ww w. j a v a2 s . c o m try { return Integer.valueOf(value.toString()); } catch (Exception e) { try { return Double.valueOf(value.toString()).intValue(); } catch (Exception e1) { return defaultValue; } } }
From source file:Main.java
public static long convertStringDateToLong(String date) { String[] splitString = date.split("[^0-9]+"); int year = Integer.valueOf(splitString[0]); int month = Integer.valueOf(splitString[1]) - 1; int day = Integer.valueOf(splitString[2]); sCalendar.set(year, month, day);// ww w . ja v a 2 s . c om return sCalendar.getTimeInMillis(); }
From source file:Main.java
public static Integer getAttributeValueAsInt(Node node, String str) { Integer num = null;/*ww w .j a va2s. c o m*/ if (!(node == null || str == null)) { try { num = Integer.valueOf(Integer.parseInt(getAttributeValue(node, str))); } catch (NumberFormatException e) { } } return num; }
From source file:Main.java
/** * "07:01" = 7*60*60*1000+1000;/*from w w w. j a v a 2s . co m*/ * @return */ public static long parseToTimeInMillis2(String string) { if (string.contains(":")) { String[] srs = string.split(":"); int h = Integer.valueOf(srs[0]); int m = Integer.valueOf(srs[1]); long hour = h * 60 * 60 * 1000; long mm = m * 60 * 1000; return hour + mm; } return 0; }
From source file:Main.java
public static long getUpdateInterval(@NonNull final String intervalFromPreference) { final int parsedValue = Integer.valueOf(intervalFromPreference); return TimeUnit.MILLISECONDS.convert(parsedValue, TimeUnit.HOURS); }
From source file:Main.java
public static boolean isSendNetWorkRequest() { boolean isSend = false; String hoursStr = new SimpleDateFormat("HH").format(new Date().getTime()); int hours = Integer.valueOf(hoursStr); if (hours > 8 && hours < 22) { isSend = true;/* w w w. j av a2 s. c om*/ } return isSend; }
From source file:Main.java
/** * get Int value/*from w w w . j ava 2s.c om*/ * * @param player * @param name * @return */ public static int getIntValue(Element e) { return Integer.valueOf(getText(e)); }
From source file:Main.java
static void checkAngle(int angle) { if ((angle < 0) || (angle > 360)) throw new IllegalArgumentException(String.format("Illegal angle %d: must be >=0 and <= 360", new Object[] { Integer.valueOf(angle) })); }
From source file:Main.java
protected static int mGetIntValueOf(String pVal, int pDefault) { if (pVal == null || pVal.isEmpty()) return pDefault; return (int) Integer.valueOf(pVal); }
From source file:Main.java
static Integer getIntValue(Element ele, String tagName) { String value = getTextValue(ele, tagName); if (isInteger(value)) return Integer.valueOf(value); else//from w w w .j a va2 s . com return null; }