List of usage examples for java.lang Integer MIN_VALUE
int MIN_VALUE
To view the source code for java.lang Integer MIN_VALUE.
Click Source Link
From source file:Main.java
public static int canParseInt(String number) { int result = Integer.MIN_VALUE; try {/*from ww w . ja v a 2 s.c o m*/ result = Integer.parseInt(number); } catch (NumberFormatException e) { e.printStackTrace(); } return result; }
From source file:Main.java
/** * Bepaalt de hoogste waarde in de lijst van integers. *///from w ww .ja v a 2 s . co m public static int max(int... values) { int max = Integer.MIN_VALUE; for (int value : values) { if (value > max) { max = value; } } return max; }
From source file:Main.java
public static Rectangle bound(Point... points) { int smallestX = Integer.MAX_VALUE; int smallestY = Integer.MAX_VALUE; int largestX = Integer.MIN_VALUE; int largestY = Integer.MIN_VALUE; for (Point point : points) { if (point == null) { continue; }//from ww w. j a v a 2s . c o m if (point.x > largestX) largestX = point.x; if (point.y > largestY) largestY = point.y; if (point.x < smallestX) smallestX = point.x; if (point.y < smallestY) smallestY = point.y; } return new Rectangle(smallestX, smallestY, largestX - smallestX, largestY - smallestY); }
From source file:Main.java
/** * Returns the KeyEvent-code (only for VK_a..Z). * If no key-event could be found, {@link Integer#MIN_VALUE} is returned. */// w ww . java 2s .c om public static int getKeyEvent(Character ch) { int ke = Integer.MIN_VALUE; try { Field f = KeyEvent.class.getField("VK_" + Character.toUpperCase(ch)); f.setAccessible(true); ke = (Integer) f.get(null); } catch (Exception e) { } return ke; }
From source file:Main.java
public static int parseInt(String s) { Matcher m = sIntMatcher.reset(s); if (!m.find()) return Integer.MIN_VALUE; return Integer.parseInt(m.group(0)); }
From source file:Main.java
public static String getKeyWithMaxValue(final Map<String, Double> pMap) { final Set<String> tempSet = pMap.keySet(); final Iterator<String> iter = tempSet.iterator(); double max = Integer.MIN_VALUE; String maxValsKey = ""; String temp = ""; while (iter.hasNext()) { temp = iter.next();//from w w w . j a v a 2 s. co m if (pMap.get(temp) > max) { max = pMap.get(temp); maxValsKey = temp; } } return maxValsKey + "\t" + max; }
From source file:Main.java
public static int mulAndCheck(int x, int y) { long m = ((long) x) * ((long) y); if (m < Integer.MIN_VALUE || m > Integer.MAX_VALUE) { throw new ArithmeticException("overflow: mul"); }//from w ww. j ava 2s . c om return (int) m; }
From source file:Main.java
public static int getIntAttribute(final Context context, final AttributeSet attrs, final String namespace, final String name, final int defValue) { final int resId = attrs.getAttributeResourceValue(namespace, name, Integer.MIN_VALUE); if (resId != Integer.MIN_VALUE) { final String string = context.getResources().getString(resId); try {/*from w ww .j a va 2s .c o m*/ return Integer.parseInt(string); } catch (final NumberFormatException e) { } } return attrs.getAttributeIntValue(namespace, name, defValue); }
From source file:Main.java
public static Boolean getBooleanAttribute(final Context context, final AttributeSet attrs, final String namespace, final String name, final Boolean defValue) { final int resId = attrs.getAttributeResourceValue(namespace, name, Integer.MIN_VALUE); if (resId != Integer.MIN_VALUE) { return context.getResources().getBoolean(resId); }// w ww .j a v a2 s . c o m String str = attrs.getAttributeValue(namespace, name); return str != null ? Boolean.valueOf(str) : defValue; }
From source file:Main.java
/** Helper method - gets a named attribute's value as a <I>short</I>. @param pNodeMap The <I>NamedNodeMap</I>. @param strName Name of the attribute. @return Value of the attribute.//w w w . j av a2s . co m */ public static short getAttributeShort(NamedNodeMap pNodeMap, String strName) throws ClassCastException, NumberFormatException { int nReturn = getAttributeInt(pNodeMap, strName); if (Integer.MIN_VALUE == nReturn) return Short.MIN_VALUE; return (short) nReturn; }