@Test public void should_be_convert_short_to_long(){ assertThat(convertToLong((short) 32767), is(32767L)); }
public static long convertToLong(Object number) { long longNumber = 0; if (number != null) { NumberType type = NumberType.valueOf(number.getClass().getSimpleName().toUpperCase()); switch (type) { case BYTE: longNumber = ((Byte) number).longValue(); break; case SHORT: longNumber = ((Short) number).longValue(); break; case INTEGER: longNumber = ((Integer) number).longValue(); break; case LONG: longNumber = (long) number; break; } } return longNumber; }
NumberConversion { public static long convertToLong(Object number) { long longNumber = 0; if (number != null) { NumberType type = NumberType.valueOf(number.getClass().getSimpleName().toUpperCase()); switch (type) { case BYTE: longNumber = ((Byte) number).longValue(); break; case SHORT: longNumber = ((Short) number).longValue(); break; case INTEGER: longNumber = ((Integer) number).longValue(); break; case LONG: longNumber = (long) number; break; } } return longNumber; } }
NumberConversion { public static long convertToLong(Object number) { long longNumber = 0; if (number != null) { NumberType type = NumberType.valueOf(number.getClass().getSimpleName().toUpperCase()); switch (type) { case BYTE: longNumber = ((Byte) number).longValue(); break; case SHORT: longNumber = ((Short) number).longValue(); break; case INTEGER: longNumber = ((Integer) number).longValue(); break; case LONG: longNumber = (long) number; break; } } return longNumber; }  }
NumberConversion { public static long convertToLong(Object number) { long longNumber = 0; if (number != null) { NumberType type = NumberType.valueOf(number.getClass().getSimpleName().toUpperCase()); switch (type) { case BYTE: longNumber = ((Byte) number).longValue(); break; case SHORT: longNumber = ((Short) number).longValue(); break; case INTEGER: longNumber = ((Integer) number).longValue(); break; case LONG: longNumber = (long) number; break; } } return longNumber; }  static String humanReadableByteCount(Long bytes, boolean decimal); static long convertToLong(Object number); }
NumberConversion { public static long convertToLong(Object number) { long longNumber = 0; if (number != null) { NumberType type = NumberType.valueOf(number.getClass().getSimpleName().toUpperCase()); switch (type) { case BYTE: longNumber = ((Byte) number).longValue(); break; case SHORT: longNumber = ((Short) number).longValue(); break; case INTEGER: longNumber = ((Integer) number).longValue(); break; case LONG: longNumber = (long) number; break; } } return longNumber; }  static String humanReadableByteCount(Long bytes, boolean decimal); static long convertToLong(Object number);  }