LiteralUtils { public static long longLiteralValue(String literalValue) { String value = literalValue.replace("_", ""); if (value.startsWith("0b") || value.startsWith("0B")) { return Long.parseUnsignedLong(value.substring(2), 2); } return Long.decode(value); } private  LiteralUtils(); static long longLiteralValue(String literalValue);  }
@Test public void decimal_values_test() { assertThat(LiteralUtils.longLiteralValue("100")).isEqualTo(100); assertThat(LiteralUtils.longLiteralValue("100_000")).isEqualTo(100000); assertThat(LiteralUtils.longLiteralValue("9223372036854775807")).isEqualTo(9223372036854775807L); }
@Test public void binary_values_test() { assertThat(LiteralUtils.longLiteralValue("0b101")).isEqualTo(5); assertThat(LiteralUtils.longLiteralValue("0b10_1")).isEqualTo(5); assertThat(LiteralUtils.longLiteralValue("0B101")).isEqualTo(5); assertThat(LiteralUtils.longLiteralValue("0B10_1")).isEqualTo(5); }
@Test public void hexadecimal_values_test() { assertThat(LiteralUtils.longLiteralValue("0x1F")).isEqualTo(31); assertThat(LiteralUtils.longLiteralValue("0x1_F")).isEqualTo(31); assertThat(LiteralUtils.longLiteralValue("0X1F")).isEqualTo(31); assertThat(LiteralUtils.longLiteralValue("0X1_F")).isEqualTo(31); }