APIdia Launch Partner
Top Constructors Methods
sun.util.calendar

public final Class CalendarUtils

extends Object
Class Inheritance

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static int
amod(int x, int y)

public static long
amod(long x, long y)

public static long

Returns:

the floor of the quotient
floorDivide
(long
the numerator
n
,
long
a divisor that must be greater than 0
d
)

Divides two integers and returns the floor of the quotient.

public static int

Returns:

the floor of the quotient
floorDivide
(int
the numerator
n
,
int
a divisor that must be greater than 0
d
)

Divides two integers and returns the floor of the quotient.

public static int

Returns:

the floor of the quotient.
floorDivide
(int
the numerator
n
,
int
a divisor which must be > 0
d
,
int[]
an array of at least one element in which the value mod(n, d) is returned.
r
)

Divides two integers and returns the floor of the quotient and the modulus remainder.

public static boolean

Returns:

true if the given year is a leap year in the Gregorian calendar system.
isGregorianLeapYear
(int
a Gregorian calendar year
gregorianYear
)

Returns whether the specified year is a leap year in the Gregorian calendar system.

public static boolean

Returns:

true if the given year is a leap year in the Julian calendar system.
isJulianLeapYear
(int
a normalized Julian calendar year
normalizedJulianYear
)

Returns whether the specified year is a leap year in the Julian calendar system.

public static long
mod(long x, long y)

public static int
mod(int x, int y)

public static StringBuilder
sprintf0d(StringBuilder sb, int value, int width)

Mimics sprintf(buf, "%0*d", decaimal, width).

public static StringBuffer
sprintf0d(StringBuffer sb, int value, int width)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

CalendarUtilsback to summary
private CalendarUtils()

Method Detail

amodback to summary
public static int amod(int x, int y)
amodback to summary
public static long amod(long x, long y)
floorDivideback to summary
public static long floorDivide(long n, long d)

Divides two integers and returns the floor of the quotient. For example, floorDivide(-1, 4) returns -1 while -1/4 is 0.

Parameters
n:long

the numerator

d:long

a divisor that must be greater than 0

Returns:long

the floor of the quotient

floorDivideback to summary
public static int floorDivide(int n, int d)

Divides two integers and returns the floor of the quotient. For example, floorDivide(-1, 4) returns -1 while -1/4 is 0.

Parameters
n:int

the numerator

d:int

a divisor that must be greater than 0

Returns:int

the floor of the quotient

floorDivideback to summary
public static int floorDivide(int n, int d, int[] r)

Divides two integers and returns the floor of the quotient and the modulus remainder. For example, floorDivide(-1,4) returns -1 with 3 as its remainder, while -1/4 is 0 and -1%4 is -1.

Parameters
n:int

the numerator

d:int

a divisor which must be > 0

r:int[]

an array of at least one element in which the value mod(n, d) is returned.

Returns:int

the floor of the quotient.

isGregorianLeapYearback to summary
public static boolean isGregorianLeapYear(int gregorianYear)

Returns whether the specified year is a leap year in the Gregorian calendar system.

Parameters
gregorianYear:int

a Gregorian calendar year

Returns:boolean

true if the given year is a leap year in the Gregorian calendar system.

See Also
CalendarDate#isLeapYear
isJulianLeapYearback to summary
public static boolean isJulianLeapYear(int normalizedJulianYear)

Returns whether the specified year is a leap year in the Julian calendar system. The year number must be a normalized one (e.g., 45 B.C.E. is 1-45).

Parameters
normalizedJulianYear:int

a normalized Julian calendar year

Returns:boolean

true if the given year is a leap year in the Julian calendar system.

See Also
CalendarDate#isLeapYear
modback to summary
public static long mod(long x, long y)
modback to summary
public static int mod(int x, int y)
sprintf0dback to summary
public static StringBuilder sprintf0d(StringBuilder sb, int value, int width)

Mimics sprintf(buf, "%0*d", decaimal, width).

sprintf0dback to summary
public static StringBuffer sprintf0d(StringBuffer sb, int value, int width)