@Test
  public void parsedNumberGetAsInt_discardsAllBut32LowestOrderBits() throws Exception {
    // It would be preferable if JsonElement.getAsInt would throw a NumberFormatException exception
    // if the number it contains does not fit into a long, similar to what Int.parseInt does.

    // Instead, the method never throws an exception, and follows the "narrowing primitive
    // conversion" of the Java Language Specification section 5.1.3, which means that all but the 32
    // lowest order bits are discarded.

    JsonElement numElement = JsonParser.parse("2147483649"); // 2^31 + 1
    assertThat(numElement.getAsInt()).isEqualTo(-2147483647);
  }
Tests for Tink's internal {@link JsonParser}.
java_src/src/test/java/com/google/crypto/tink/internal/JsonParserTest.java