Implement ResizableIntArray.setLength and .get

This change revises ResizableIntArrayTests as well.
diff --git a/java/proguard.flags b/java/proguard.flags
index 1633522..1711b99 100644
--- a/java/proguard.flags
+++ b/java/proguard.flags
@@ -24,6 +24,10 @@
   *;
 }
 
+-keep class com.android.inputmethod.latin.ResizableIntArray {
+  *;
+}
+
 -keep class com.android.inputmethod.latin.spellcheck.SpellCheckerSettingsFragment {
   *;
 }
diff --git a/java/src/com/android/inputmethod/latin/ResizableIntArray.java b/java/src/com/android/inputmethod/latin/ResizableIntArray.java
index 2079c0e..6feae9c 100644
--- a/java/src/com/android/inputmethod/latin/ResizableIntArray.java
+++ b/java/src/com/android/inputmethod/latin/ResizableIntArray.java
@@ -23,11 +23,18 @@
     private int[] mArray;
     private int mLength;
 
-    public ResizableIntArray(int capacity) {
+    public ResizableIntArray(final int capacity) {
         reset(capacity);
     }
 
-    public void add(int index, int val) {
+    public int get(final int index) {
+        if (index < 0 || index >= mLength) {
+            throw new ArrayIndexOutOfBoundsException("length=" + mLength + "; index=" + index);
+        }
+        return mArray[index];
+    }
+
+    public void add(final int index, final int val) {
         if (mLength < index + 1) {
             mLength = index;
             add(val);
@@ -36,14 +43,14 @@
         }
     }
 
-    public void add(int val) {
+    public void add(final int val) {
         final int nextLength = mLength + 1;
         ensureCapacity(nextLength);
         mArray[mLength] = val;
         mLength = nextLength;
     }
 
-    private void ensureCapacity(int minimumCapacity) {
+    private void ensureCapacity(final int minimumCapacity) {
         if (mArray.length < minimumCapacity) {
             final int nextCapacity = mArray.length * 2;
             // The following is the same as newLength =
@@ -60,9 +67,12 @@
         return mLength;
     }
 
-    // TODO: Implement setLength(int).
+    public void setLength(final int newLength) {
+        ensureCapacity(newLength);
+        mLength = newLength;
+    }
 
-    public void reset(int capacity) {
+    public void reset(final int capacity) {
         // TODO: Implement primitive array pool.
         mArray = new int[capacity];
         mLength = 0;
@@ -72,20 +82,20 @@
         return mArray;
     }
 
-    public void set(ResizableIntArray ip) {
+    public void set(final ResizableIntArray ip) {
         // TODO: Implement primitive array pool.
         mArray = ip.mArray;
         mLength = ip.mLength;
     }
 
-    public void copy(ResizableIntArray ip) {
+    public void copy(final ResizableIntArray ip) {
         // TODO: Avoid useless coping of values.
         ensureCapacity(ip.mLength);
         System.arraycopy(ip.mArray, 0, mArray, 0, ip.mLength);
         mLength = ip.mLength;
     }
 
-    public void append(ResizableIntArray src, int startPos, int length) {
+    public void append(final ResizableIntArray src, final int startPos, final int length) {
         final int currentLength = mLength;
         final int newLength = currentLength + length;
         ensureCapacity(newLength);