Fix an array copy optimization bug.

When we copy within the same array, we need to take care of
overlapping range cases and copy backward in some cases. Verifed with
TestBigDecimal and CTS tests.api.java.math.BigDecimalTest.

Bug: 11233386
Bug: 9986565

(cherry picked from commit 7f2504897c33ab3c312028b4546818bc2d037bc7)

Change-Id: I5243c01222c58c137ad2595048372022c689576d
Merge "Fix an array copy optimization bug." into kitkat