rem BitSet alternative to HashSet

BitSet bitSet = new BitSet ( 10 ); // indexed 0..9
bitSet.set( 0 );
bitSet.set( 5 );

if ( bitSet.get( index ) )
  {
  out.println( index + " is in the set" );
  }