public void Solve() {
        HashMap<String, List<String>> hashMap = new HashMap<String, List<String>>();
        String result = "";
        for (int n = 1; n < _max; n++) {
            String cube = Cube(n);
            String key = SortString(cube);

            List<String> cubes = hashMap.get(key);
            if (cubes == null) {
                cubes = new ArrayList<String>();
                hashMap.put(key, cubes);
            }
            cubes.add(cube);
            if (_permutations <= cubes.size()) {
                Collections.sort(cubes);
                String candidate = cubes.get(0);
                if (result.equals("") || candidate.compareTo(result) < 0) {
                    result = candidate;
                    System.out.println("n=" + n + ", n^3=" + result);
                }
            }
        }

        System.out.println("Result=" + result);
    }