### Question:
NumberUtil { public static byte[] toBytes(int value) { return Ints.toByteArray(value); }  static boolean equalsWithin(double d1, double d2); static boolean equalsWithin(double d1, double d2, double epsilon); static byte[] toBytes(int value); static byte[] toBytes(long value); static byte[] toBytes(double val); static int toInt(byte[] bytes); static long toLong(byte[] bytes); static double toDouble(byte[] bytes); static boolean isNumber(@Nullable String str); static boolean isHexNumber(@Nullable String value); static int toInt(@NotNull String str); static int toInt(@Nullable String str, int defaultValue); static long toLong(@NotNull String str); static long toLong(@Nullable String str, long defaultValue); static double toDouble(@NotNull String str); static double toDouble(@Nullable String str, double defaultValue); static Integer toIntObject(@NotNull String str); static Integer toIntObject(@Nullable String str, Integer defaultValue); static Long toLongObject(@NotNull String str); static Long toLongObject(@Nullable String str, Long defaultValue); static Double toDoubleObject(@NotNull String str); static Double toDoubleObject(@Nullable String str, Double defaultValue); static Integer hexToIntObject(@NotNull String str); static Integer hexToIntObject(@Nullable String str, Integer defaultValue); static Long hexToLongObject(@NotNull String str); static Long hexToLongObject(@Nullable String str, Long defaultValue); static String toString(int i); static String toString(@NotNull Integer i); static String toString(long l); static String toString(@NotNull Long l); static String toString(double d); static String toString(@NotNull Double d); static String to2DigitString(double d); static int toInt32(long x);  }### Answer:
@Test public void toBytes() { byte[] bytes = NumberUtil.toBytes(1); assertThat(bytes).hasSize(4).containsSequence((byte) 0, (byte) 0, (byte) 0, (byte) 1); bytes = NumberUtil.toBytes(257); assertThat(bytes).containsSequence((byte) 0, (byte) 0, (byte) 1, (byte) 1); assertThat(NumberUtil.toInt(bytes)).isEqualTo(257); byte[] bytes2 = NumberUtil.toBytes(1L); assertThat(bytes2).hasSize(8); bytes2 = NumberUtil.toBytes(257L); assertThat(bytes2).containsSequence((byte) 0, (byte) 0, (byte) 1, (byte) 1); assertThat(NumberUtil.toLong(bytes2)).isEqualTo(257L); byte[] bytes3 = NumberUtil.toBytes(1.123d); assertThat(NumberUtil.toDouble(bytes3)).isEqualTo(1.123d); assertThat(NumberUtil.toInt32(123l)).isEqualTo(123); try { NumberUtil.toInt32(Long.valueOf(Integer.MAX_VALUE + 1l)); fail("should fail here"); } catch (Exception e) { assertThat(e).isInstanceOf(IllegalArgumentException.class); } }