List of utility methods to do Short Number Create
short | toShort(int unsignedShort) Converts an int containing an unsigned short value to the corresponding signed short value and returns the result as a short if (unsignedShort < 0 || unsignedShort > MAX_SHORT) { throw new IllegalArgumentException(String.format( "Unsigned byte values should be in the range 0..%1$d, got: %2$d", MAX_SHORT, unsignedShort)); return (short) unsignedShort; |
short | toShort(long l) to Short if (l < Short.MIN_VALUE || l > Short.MAX_VALUE) throw new ArithmeticException("Value (" + l + ") cannot fit into short"); return (short) l; |
short | toShort(long n) to Short if (n < Short.MIN_VALUE || Short.MAX_VALUE < n) { throw new IllegalArgumentException("value out of range: " + n); return (short) n; |
Short | toShort(Number num) Convert the given number into a Short instance. return (num == null) ? null : Short.valueOf(num.shortValue());
|
Short | toShort(Number value) to Short if (value == null) { return null; } else if (value instanceof Short) { return (Short) value; } else { return Short.valueOf(value.shortValue()); |
Short | toShort(Object o) to Short if (o == null) return null; if (o.getClass() == Short.class) return (Short) o; if (o.getClass() == Boolean.class) return booleanToShort((Boolean) o); if (o.getClass() == Byte.class) return (short) ((Byte) o).byteValue(); ... |
Short | toShort(Object ob, Short defaultShort) to Short if (ob == null) { return defaultShort; if (ob instanceof Integer) { return ((Integer) ob).shortValue(); } else if (ob instanceof Float) { return ((Float) ob).shortValue(); } else if (ob instanceof Double) { ... |
short | toShort(Object obj) Convert object returned from server to short. return (short) toLong(obj); |
short | toShort(Object obj) to Short return toShort(obj, (byte) 0); |
short | toShort(Object obj) Get the short value of this object, only if the object is an instance of Number return (obj instanceof Number) ? ((Number) obj).shortValue() : 0; |