You can't resize an array, I think that much is obvious by now, but, if you can't use of the of List implementations of the Collections API, you can create a new array, that is larger than the first, and copy it's contents to it, then replace the reference.
String[] values = new String[10];
String[] newValues = new String[20];
System.arraycopy(values, 0, newValues, 0, values.length);
values = newValues;
You could wrap this in a method to make it easier...
public String[] grow(String[] source, int newSize) {
String[] newValues = new String[20];
System.arraycopy(source, 0, newValues, 0, source.length);
return newValues;
}
Personally, though...I'd seriously consider using something like ArrayList or LinkedList...it's just simpler ;)
pm.get(124);would do it ifpmwas an ArrayList. More: docs.oracle.com/javase/7/docs/api/java/util/…get. Please see my answer.