private int[] doComplement(){
  if (empty()) {
    int[] result=new int[2];
    result[0]=0x0000;
    result[1]=0x10FFFF;
    return result;
  }
  int[] result=new int[chars.length + 2];
  int i=0;
  int index=0;
  if (chars[0] != 0x0000) {
    result[index++]=0x0000;
  }
  while (i < chars.length) {
    if (chars[i] != 0x0000) {
      result[index++]=chars[i] - 1;
    }
    if (chars[i + 1] != 0x10FFFF) {
      result[index++]=chars[i + 1] + 1;
    }
    i+=2;
  }
  if (chars[i - 1] != 0x10FFFF) {
    result[index++]=0x10FFFF;
  }
  if (result.length > index) {
    int[] tmpbuf=new int[index];
    System.arraycopy(result,0,tmpbuf,0,index);
    return tmpbuf;
  }
  return result;
}

private int [ ] doComplement ( ) { if ( empty ( ) ) { int [ ] result = new int [ 2 ] ; result [ 0 ] = 0x0000 ; result [ 1 ] = 0x10FFFF ; return result ; } int [ ] result = new int [ chars . length + 2 ] ; int i = 0 ; int index = 0 ; if ( chars [ 0 ] != 0x0000 ) { result [ index ++ ] = 0x0000 ; } while ( i < chars . length ) { if ( chars [ i ] != 0x0000 ) { result [ index ++ ] = chars [ i ] - 1 ; } if ( chars [ i + 1 ] != 0x10FFFF ) { result [ index ++ ] = chars [ i + 1 ] + 1 ; } i += 2 ; } if ( chars [ i - 1 ] != 0x10FFFF ) { result [ index ++ ] = 0x10FFFF ; } if ( result . length > index ) { int [ ] tmpbuf = new int [ index ] ; System . arraycopy ( result , 0 , tmpbuf , 0 , index ) ; return tmpbuf ; } return result ; }
the internal implementation function for the complement routines
