return clone(array);
}
final HashMap<Short, MutableInt> occurrences = new HashMap<Short, MutableInt>(values.length);
for (final short v : values) {
final Short boxed = Short.valueOf(v);
final MutableInt count = occurrences.get(boxed);
if (count == null) {
occurrences.put(boxed, new MutableInt(1));
} else {
count.increment();
}
}
final BitSet toRemove = new BitSet();
for (final Map.Entry<Short, MutableInt> e : occurrences.entrySet()) {
final Short v = e.getKey();