org.apache.commons.lang3.math.NumberUtils#max ( )源码实例Demo

下面列出了org.apache.commons.lang3.math.NumberUtils#max ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: pragmatic-java-engineer   文件: CommonsExample.java
public static void lang() throws NoSuchMethodException, IllegalAccessException, InvocationTargetException {
    String[] strs = new String[]{"1", "4", "2"};
    ArrayUtils.addAll(strs, "3");

    RandomUtils.nextInt(0, 10);
    RandomStringUtils.random(3);

    StopWatch stopWatch = new StopWatch();
    stopWatch.start();
    stopWatch.split();
    stopWatch.getSplitTime();
    stopWatch.suspend();
    stopWatch.resume();
    stopWatch.stop();
    stopWatch.getTime();

    long max = NumberUtils.max(new long[]{1, 5, 10}); //计算数组最大值

    MethodUtils.invokeStaticMethod(StringUtils.class, "isNotBlank", "test"); //调用静态方法
    MethodUtils.invokeMethod(StringUtils.class, "isNotBlank", "test"); //调用静态方法

    DateUtils.truncate(new Date(), Calendar.HOUR);
    DateFormatUtils.format(new Date(), "yyyyMMdd");
}
 
源代码2 项目: cuba   文件: NumberAggregationHelper.java
@Nullable
public Double max() {
    if (items.isEmpty()) {
        return null;
    }

    return NumberUtils.max(ArrayUtils.toPrimitive(items.toArray(new Double[items.size()])));
}
 
源代码3 项目: levelup-java-examples   文件: MaxValueInArray.java
@Test
public void find_max_value_in_array_with_apache_commons () {
	int highest = NumberUtils.max(numbers);
	assertEquals(91, highest);
}
 
源代码4 项目: px2rwd-intellij-plugin   文件: FormatTools.java
/**
 * 取一个长度单位的起始index
 *
 * @param content 待处理文本
 * @return 返回文本中包含的一个长度单位的起始index
 */
private int getNearCode(String content) {
    return NumberUtils.max(StringUtils.lastIndexOf(content, COLON_STRING), StringUtils.lastIndexOf(content, BLANK_STRING));
}