private Object extendArray (Object array, int currentSize, int requiredSize) { if (requiredSize < currentSize) { return array; } else { Object newArray = null; int newSize = currentSize * 2;  if (newSize <= requiredSize) newSize = requiredSize + 1;  if (array instanceof char[]) newArray = new char [newSize]; else if (array instanceof Object[]) newArray = new Object [newSize]; else throw new RuntimeException ();  System.arraycopy (array, 0, newArray, 0, currentSize); return newArray; } }
private Object extendArray(Object array, int currentSize, int requiredSize) { if (requiredSize < currentSize) { return array; } else { Object newArray = null; int newSize = currentSize * 2;  if (newSize <= requiredSize) { newSize = requiredSize + 1; }  if (array instanceof char[]) { newArray = new char[newSize]; } else if (array instanceof Object[]) { newArray = new Object[newSize]; } else { throw new RuntimeException(); }  System.arraycopy(array, 0, newArray, 0, currentSize); return newArray; } }
    private Object extendArray (Object array, int currentSize, int requiredSize)    {	if (requiredSize < currentSize) {	    return array;	} else {	    Object newArray = null;	    int newSize = currentSize * 2;	    if (newSize <= requiredSize)		newSize = requiredSize + 1;	    if (array instanceof char[])		newArray = new char [newSize];	    else if (array instanceof Object[])		newArray = new Object [newSize];	    else		throw new RuntimeException ();	    System.arraycopy (array, 0, newArray, 0, currentSize);	    return newArray;	}    }