private static int solve(int n) {
        if (n == 1)
            return 0;
        int k = 0;
        int d = 1;
        int i = 1;
        while (d < n) {
            k += 8;
            d += k;
            i += 2;
        }
        int ii, jj;
        int lbc = d - i + 1;
        int luc = lbc - i + 1;
        int ruc = luc - i + 1;
        if (n <= d && n >= lbc) {
            ii = i - 1;
            jj = n - lbc;
        } else if (n <= lbc && n >= luc) {
            ii = n - luc;
            jj = 0;
        } else if (n <= luc && n >= ruc) {
            ii = 0;
            jj = luc - n;
        } else {
            ii = ruc - n;
            jj = i - 1;
        }
        return Math.abs(ii - i / 2) + Math.abs(jj - i / 2);
    }
Why Did you create this class? what does it do?
src/adventofcode/SpiralMemory_3.java