private static Date fixedToDate(int n) {
		int d0 = n - 1;
		int n400 = divF(d0, 146097);
		int d1 = modF(d0, 146097);
		int n100 = divF(d1, 36524);
		int d2 = modF(d1, 36524);
		int n4 = divF(d2, 1461);
		int d3 = modF(d2, 1461);
		int n1 = divF(d3, 365);
		int y0 = 400 * n400 + 100 * n100 + 4 * n4 + n1;
		int y;
		if (n100 == 4 || n1 == 4) {
			y = y0;
		} else {
			y = y0 + 1;
		}

		int p = n - dateToFixed(1, intToMonth(1), y);

		boolean l = (modF(y, 4) == 0 && modF(y, 100) != 0)
				|| (modF(y, 400) == 0);

		int c;
		if (n < dateToFixed(1, intToMonth(3), y)) {
			c = 0;
		} else if ((n >= dateToFixed(1, intToMonth(3), y)) && l) {
			c = 1;
		} else {
			c = 2;
		}

		int m = divF((12 * (p + c) + 373), 367);

		int d = n - dateToFixed(1, intToMonth(m), y) + 1;

		return new Date(d, m, y);
	}