Fixes mismatch between Java and C++ indices. am: 47c9e5861f
am: 8d336d984a

Change-Id: Ie975c0fbc33141fdfb2d640f76a281aa9e5cc7cd