question: public void compressMyOwnWay ( int [ ] indexes ) { List < Integer > list = new ArrayList < Integer > ( CarbonCommonConstants . CONSTANT_SIZE_TEN ) ; List < Integer > map = new ArrayList < Integer > ( CarbonCommonConstants . CONSTANT_SIZE_TEN ) ; int k = 0 ; int i = 1 ; for ( ; i < indexes . length ; i ++ ) { if ( indexes [ i ] - indexes [ i - 1 ] == 1 ) { k ++ ; } else { if ( k > 0 ) { map . add ( ( list . size ( ) ) ) ; list . add ( indexes [ i - k - 1 ] ) ; list . add ( indexes [ i - 1 ] ) ; } else { list . add ( indexes [ i - 1 ] ) ; } k = 0 ; } } if ( k > 0 ) { map . add ( ( list . size ( ) ) ) ; list . add ( indexes [ i - k - 1 ] ) ; list . add ( indexes [ i - 1 ] ) ; } else { list . add ( indexes [ i - 1 ] ) ; } dataAfterComp = convertToArray ( list ) ; if ( indexes . length == dataAfterComp . length ) { indexMap = new int [ 0 ] ; } else { indexMap = convertToArray ( map ) ; } if ( dataAfterComp . length == 2 && indexMap . length == 1 ) { alreadySorted = true ; } }
target:  It compresses depends up on the sequence numbers. [1,2,3,4,6,8,10,11,12,13] is translated to [1,4,6,8,10,13] and [0,6]. In first array the start and end of sequential numbers and second array keeps the indexes of where sequential numbers starts. If there is no sequential numbers then the same array it returns with empty second array.