public int [ ] asArray ( ) { int arr [ ] = new int [ size ( ) ] ; OrdinalIterator iter = iterator ( ) ; int ordinal = iter . nextOrdinal ( ) ; int i = 0 ; while ( ordinal != NO_MORE_ORDINALS ) { arr [ i ++ ] = ordinal ; ordinal = iter . nextOrdinal ( ) ; } return arr ; }
Returns an array containing all elements in the set .