List of utility methods to do Short Number Create
short | toShort(String str) Converts a string to a short . return Short.parseShort(str);
|
String | toShort(String str, int maxLen) to Short return toShort(str, maxLen, "..."); |
short | toShort(String str, short defaultValue) Convert a if (str == null) { return defaultValue; try { return Short.parseShort(str); } catch (NumberFormatException nfe) { return defaultValue; |
short | toShort(String value) to Short if (!isBinary(value)) return 0; if (value.length() > 7) return 127; return (short) Integer.parseInt(value, 2); |
short | toShort(String value) to Short return toShort(value, (short) 0); |
Short | toShort(String value) to Short if (null == value) { return null; value = value.trim(); if ("null".equals(value)) { return null; Double d = Double.parseDouble(value); ... |
short | toShort(String value, short defaultValue) convert the string to an short, and return the default value if the string is null or does not contain a valid int value if (value != null) { try { return Short.parseShort(value); } catch (NumberFormatException n) { return defaultValue; |
short[] | toShort(String[] arr) to Short short[] s = new short[arr.length]; for (int i = 0; i < arr.length; ++i) s[i] = Short.parseShort(arr[i]); return s; |