int[] gjFromFixed(long date) {
        long approx = div(4 * (date - JULIAN_EPOCH) + 1464, 1461);
        long year = (approx <= 0) ? approx - 1 : approx;
        int year_i = (int)year;
        if (year_i != year) {
            throw new RuntimeException("year cannot be cast to an int: " + year);
        }
        long priorDays = date - fixedFromGJ(year_i, 1, 1);
        long correction;
        if (date < fixedFromGJ(year_i, 3, 1)) {
            correction = 0;
        } else if (isLeapYear(year_i)) {
            correction = 1;
        } else {
            correction = 2;
        }
        int monthOfYear = (int)div(12 * (priorDays + correction) + 373, 367);
        int day = (int)(date - fixedFromGJ(year_i, monthOfYear, 1) + 1);

        return new int[]{year_i, monthOfYear, day};
    }