Java: Don't allow int overflow in buf size methods This is similar to the fix that 2a9e3bd7430cfda1bc812d139e0609c6aca0b884 applied to the C API. We have to apply it separately at the JNI level because the Java API always stores buffer sizes in 32-bit integers, and the C buffer size functions could overflow an int when using 64-bit code. (NOTE: The Java API stores buffer sizes in 32-bit integers because Java itself always uses 32-bit integers for array sizes.) Since Java don't allow no buffer overruns 'round here, this commit doesn't change the ultimate outcome. It just makes the inevitable exception easier to diagnose.