question: public static double [ ] coalesce_points ( double [ ] radians , double eps , boolean ispolyg ) { int write = 2 ; int len = radians . length ; for ( int i = write - 2 , j = write ; j < len ; j += 2 ) { double lat1 = ProjMath . radToDeg ( radians [ i ] ) ; double lon1 = ProjMath . radToDeg ( radians [ i + 1 ] ) ; double lat2 = ProjMath . radToDeg ( radians [ j ] ) ; double lon2 = ProjMath . radToDeg ( radians [ j + 1 ] ) ; if ( MoreMath . approximately_equal ( lat1 , lat2 , eps ) && MoreMath . approximately_equal ( lon1 , lon2 , eps ) ) { continue ; } i = write ; radians [ write ++ ] = radians [ j ] ; radians [ write ++ ] = radians [ j + 1 ] ; } if ( ispolyg && ( write == 6 ) && MoreMath . approximately_equal ( radians [ 0 ] , radians [ 4 ] , eps ) && MoreMath . approximately_equal ( radians [ 1 ] , radians [ 5 ] , eps ) ) { write -= 2 ; } double [ ] newrads = new double [ write ] ; System . arraycopy ( radians , 0 , newrads , 0 , write ) ; return newrads ; }
target:  traverse array and coalesce adjacent points which are the same 