List of utility methods to do Long to Short
short | Long2Short(long i) Long Short short o; try { o = new Long(i).shortValue(); } catch (Exception e) { o = 0; return o; |
short | long2short(long l) Converts a Long value to a Short value. return (short) ((l << 48) >> 48); |
short | long2short(long l) longshort return (short) (int) (l << 48 >> 48); |
Short | longToShort(final long value) long To Short return (short) value; |
Short | longToShort(long l) long To Short if (l >= Short.MIN_VALUE && l <= Short.MAX_VALUE) { return (short) l; return null; |
short[] | longToShort(long[] values) long To Short if (values == null) { return null; short[] results = new short[values.length]; for (int i = 0; i < values.length; i++) { results[i] = (short) values[i]; return results; ... |
short | longToShortBounds(long value) casts a long to an short, but if the long is outside the short-range, it will mapped to the end of the range if (value > Short.MAX_VALUE) return Short.MAX_VALUE; else if (value < Short.MIN_VALUE) return Short.MIN_VALUE; else return (short) value; |
short[] | longToShorts(long n) long To Shorts return longToShorts(n, new short[4], 0); |
short[] | longToShorts(long value) long To Shorts short[] shorts = new short[4]; shorts[0] = (short) (value >>> 48); shorts[1] = (short) (value >>> 32); shorts[2] = (short) (value >>> 16); shorts[3] = (short) (value >>> 0); return shorts; |