question: public void closeArray ( ) { int l = coords . length ; int i = l - 3 ; if ( coords [ 0 ] != coords [ i ] || coords [ 1 ] != coords [ i + 1 ] || coords [ 2 ] != coords [ i + 2 ] ) { double [ ] newCoords = new double [ l + 3 ] ; System . arraycopy ( coords , 0 , newCoords , 0 , l ) ; newCoords [ l ] = coords [ 0 ] ; newCoords [ l + 1 ] = coords [ 1 ] ; newCoords [ l + 2 ] = coords [ 2 ] ; coords = newCoords ; } }
target:  Ensure that the Geo array starts and ends with the same values. Will replace the current coord array with one three double longer if needed.