本文整理匯總了Java中java.util.Calendar.getLeastMaximum方法的典型用法代碼示例。如果您正苦於以下問題:Java Calendar.getLeastMaximum方法的具體用法?Java Calendar.getLeastMaximum怎麽用?Java Calendar.getLeastMaximum使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類java.util.Calendar
的用法示例。
在下文中一共展示了Calendar.getLeastMaximum方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: testLeastMax
import java.util.Calendar; //導入方法依賴的package包/類
/**
* 4956227: getLeastMaximum(WEEK_OF_MONTH) return diff. val. for Greg. and Buddhist Calendar
*/
static void testLeastMax() {
Calendar bc = getBuddhistCalendar();
// Specify THAI_LOCALE to get the same params for WEEK
// calculations (6904680).
Calendar gc = new GregorianCalendar(THAI_LOCALE);
for (int f = 0; f < Calendar.FIELD_COUNT; f++) {
if (f == ERA || f == YEAR) {
continue;
}
int bn = bc.getLeastMaximum(f);
int gn = gc.getLeastMaximum(f);
if (bn != gn) {
throw new RuntimeException("inconsistent Least Max value for " + Koyomi.getFieldName(f)
+ ": Buddhist=" + bn
+ ": Gregorian=" + gn);
}
}
}
示例2: Test4118384
import java.util.Calendar; //導入方法依賴的package包/類
/**
* Make sure maximum for HOUR field is 11, not 12.
*/
public void Test4118384() {
Calendar cal = Calendar.getInstance();
if (cal.getMaximum(HOUR) != 11
|| cal.getLeastMaximum(HOUR) != 11
|| cal.getActualMaximum(HOUR) != 11) {
errln("Fail: maximum of HOUR field should be 11");
}
}
示例3: appendTo
import java.util.Calendar; //導入方法依賴的package包/類
/**
* {@inheritDoc}
*/
@Override
public void appendTo(final StringBuffer buffer, final Calendar calendar) {
int value = calendar.get(Calendar.HOUR);
if (value == 0) {
value = calendar.getLeastMaximum(Calendar.HOUR) + 1;
}
mRule.appendTo(buffer, value);
}
示例4: appendTo
import java.util.Calendar; //導入方法依賴的package包/類
/**
* {@inheritDoc}
*/
public void appendTo(StringBuffer buffer, Calendar calendar) {
int value = calendar.get(Calendar.HOUR);
if (value == 0) {
value = calendar.getLeastMaximum(Calendar.HOUR) + 1;
}
mRule.appendTo(buffer, value);
}