CalendarUtils

CalendarUtils

package sun.util.calendar;

public class CalendarUtils {
    public static final boolean isGregorianLeapYear(int arg) {
        return arg % 4 == 0 && (arg % 100 != 0 || arg % 400 == 0);
    }

    public static final boolean isJulianLeapYear(int arg) {
        return arg % 4 == 0;
    }

    public static final long floorDivide(long arg, long arg1) {
        return arg >= 0L ? arg / arg1 : (arg + 1L) / arg1 - 1L;
    }

    public static final int floorDivide(int arg, int arg0) {
        return arg >= 0 ? arg / arg0 : (arg + 1) / arg0 - 1;
    }

    public static final int floorDivide(int arg, int arg0, int[] arg1) {
        if (arg >= 0) {
            arg1[0] = arg % arg0;
            return arg / arg0;
        } else {
            int arg2 = (arg + 1) / arg0 - 1;
            arg1[0] = arg - arg2 * arg0;
            return arg2;
        }
    }

    public static final int floorDivide(long arg, int arg1, int[] arg2) {
        if (arg >= 0L) {
            arg2[0] = (int) (arg % (long) arg1);
            return (int) (arg / (long) arg1);
        } else {
            int arg3 = (int) ((arg + 1L) / (long) arg1 - 1L);
            arg2[0] = (int) (arg - (long) (arg3 * arg1));
            return arg3;
        }
    }

    public static final long mod(long arg, long arg1) {
        return arg - arg1 * floorDivide(arg, arg1);
    }

    public static final int mod(int arg, int arg0) {
        return arg - arg0 * floorDivide(arg, arg0);
    }

    public static final int amod(int arg, int arg0) {
        int arg1 = mod(arg, arg0);
        return arg1 == 0 ? arg0 : arg1;
    }

    public static final long amod(long arg, long arg1) {
        long arg3 = mod(arg, arg1);
        return arg3 == 0L ? arg1 : arg3;
    }

    public static final StringBuilder sprintf0d(StringBuilder arg, int arg0, int arg1) {
        long arg2 = (long) arg0;
        if (arg2 < 0L) {
            arg.append('-');
            arg2 = -arg2;
            --arg1;
        }

        int arg4 = 10;

        int arg5;
        for (arg5 = 2; arg5 < arg1; ++arg5) {
            arg4 *= 10;
        }

        for (arg5 = 1; arg5 < arg1 && arg2 < (long) arg4; ++arg5) {
            arg.append('0');
            arg4 /= 10;
        }

        arg.append(arg2);
        return arg;
    }

    public static final StringBuffer sprintf0d(StringBuffer arg, int arg0, int arg1) {
        long arg2 = (long) arg0;
        if (arg2 < 0L) {
            arg.append('-');
            arg2 = -arg2;
            --arg1;
        }

        int arg4 = 10;

        int arg5;
        for (arg5 = 2; arg5 < arg1; ++arg5) {
            arg4 *= 10;
        }

        for (arg5 = 1; arg5 < arg1 && arg2 < (long) arg4; ++arg5) {
            arg.append('0');
            arg4 /= 10;
        }

        arg.append(arg2);
        return arg;
    }
}

 

 

 

##################

posted @ 2022-08-17 07:15  西北逍遥  阅读(49)  评论(0编辑  收藏  举报