[java] Make Int64 behaviour more consistent. Closes #2752 . Closes #3203