public static float[] closeLLa(float[] lla){
  int l=lla.length;
  int s=(l / 2) - 1;
  if (lla[0] == lla[s * 2] && lla[1] == lla[s * 2 + 1]) {
    return lla;
  }
 else {
    float[] llx=new float[l + 2];
    System.arraycopy(lla,0,llx,0,l);
    llx[l]=lla[0];
    llx[l + 1]=lla[1];
    return llx;
  }
}

public static float [ ] closeLLa ( float [ ] lla ) { int l = lla . length ; int s = ( l / 2 ) - 1 ; if ( lla [ 0 ] == lla [ s * 2 ] && lla [ 1 ] == lla [ s * 2 + 1 ] ) { return lla ; } else { float [ ] llx = new float [ l + 2 ] ; System . arraycopy ( lla , 0 , llx , 0 , l ) ; llx [ l ] = lla [ 0 ] ; llx [ l + 1 ] = lla [ 1 ] ; return llx ; } }
return a float array of alternating lat lon pairs where the first and last pair are the same , thus closing the path , by adding a point if needed . does not mutate the input .
