Backport Fix #1162: Implement java.lang.Arrays.equals

(cherry picked from commit cb3712895d0ba4e55c1e6a806581e8024199cc0a)