本文整理汇总了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);
}