public static int[] createNormalizedMap(int[] values,byte[] levels,int start,int limit){
  if (values != null) {
    if (start != 0 || limit != values.length) {
      boolean copyRange, canonical;
      byte primaryLevel;
      if (levels == null) {
        primaryLevel=(byte)0x0;
        copyRange=true;
        canonical=true;
      }
 else {
        if (levels[start] == levels[limit - 1]) {
          primaryLevel=levels[start];
          canonical=(primaryLevel & (byte)0x1) == 0;
          int i;
          for (i=start; i < limit; i++) {
            if (levels[i] < primaryLevel) {
              break;
            }
            if (canonical) {
              canonical=levels[i] == primaryLevel;
            }
          }
          copyRange=(i == limit);
        }
 else {
          copyRange=false;
          primaryLevel=(byte)0x0;
          canonical=false;
        }
      }
      if (copyRange) {
        if (canonical) {
          return null;
        }
        int[] result=new int[limit - start];
        int baseValue;
        if ((primaryLevel & (byte)0x1) != 0) {
          baseValue=values[limit - 1];
        }
 else {
          baseValue=values[start];
        }
        if (baseValue == 0) {
          System.arraycopy(values,start,result,0,limit - start);
        }
 else {
          for (int j=0; j < result.length; j++) {
            result[j]=values[j + start] - baseValue;
          }
        }
        return result;
      }
 else {
        return computeContiguousOrder(values,start,limit);
      }
    }
 else {
      return values;
    }
  }
  return null;
}

public static int [ ] createNormalizedMap ( int [ ] values , byte [ ] levels , int start , int limit ) { if ( values != null ) { if ( start != 0 || limit != values . length ) { boolean copyRange , canonical ; byte primaryLevel ; if ( levels == null ) { primaryLevel = ( byte ) 0x0 ; copyRange = true ; canonical = true ; } else { if ( levels [ start ] == levels [ limit - 1 ] ) { primaryLevel = levels [ start ] ; canonical = ( primaryLevel & ( byte ) 0x1 ) == 0 ; int i ; for ( i = start ; i < limit ; i ++ ) { if ( levels [ i ] < primaryLevel ) { break ; } if ( canonical ) { canonical = levels [ i ] == primaryLevel ; } } copyRange = ( i == limit ) ; } else { copyRange = false ; primaryLevel = ( byte ) 0x0 ; canonical = false ; } } if ( copyRange ) { if ( canonical ) { return null ; } int [ ] result = new int [ limit - start ] ; int baseValue ; if ( ( primaryLevel & ( byte ) 0x1 ) != 0 ) { baseValue = values [ limit - 1 ] ; } else { baseValue = values [ start ] ; } if ( baseValue == 0 ) { System . arraycopy ( values , start , result , 0 , limit - start ) ; } else { for ( int j = 0 ; j < result . length ; j ++ ) { result [ j ] = values [ j + start ] - baseValue ; } } return result ; } else { return computeContiguousOrder ( values , start , limit ) ; } } else { return values ; } } return null ; }
return an array containing the data in the values array from start up to limit , normalized to fall within the range from 0 up to limit - start . if this would be a canonical ltr ordering , return null . note : this method assumes that values [ ] is a logical to visual map generated from levels [ ] .
