Update subsets.java

Extract into a helper