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;
  }
}

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 ; } }
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 .
