### Question:
Crack { static int[] factors(int n) { List<Integer> results = new LinkedList<>(); for (int i = n; i > 0; i--) { BigDecimal remainder = new BigDecimal(n).remainder(new BigDecimal(i)); if (remainder.compareTo(BigDecimal.ZERO) == 0) results.add(i); } return toArray(results); }    }### Answer:
@Test public void factors() { assertArrayEquals(new int[]{ 2, 1 }, Crack.factors(2)); assertArrayEquals(new int[]{ 4, 2, 1 }, Crack.factors(4)); assertArrayEquals(new int[]{ 16, 8, 4, 2, 1 }, Crack.factors(16)); assertArrayEquals(new int[]{ 30, 15, 10, 6, 5, 3, 2, 1 }, Crack.factors(30)); }