Java Code Examples for org.apache.commons.lang3.math.NumberUtils#max()

The following examples show how to use org.apache.commons.lang3.math.NumberUtils#max() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
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");
}
 
Example 2
Source Project: cuba   File: NumberAggregationHelper.java    License: Apache License 2.0 5 votes vote down vote up
@Nullable
public Double max() {
    if (items.isEmpty()) {
        return null;
    }

    return NumberUtils.max(ArrayUtils.toPrimitive(items.toArray(new Double[items.size()])));
}
 
Example 3
@Test
public void find_max_value_in_array_with_apache_commons () {
	int highest = NumberUtils.max(numbers);
	assertEquals(91, highest);
}
 
Example 4
Source Project: px2rwd-intellij-plugin   File: FormatTools.java    License: MIT License 2 votes vote down vote up
/**
 * 取一个长度单位的起始index
 *
 * @param content 待处理文本
 * @return 返回文本中包含的一个长度单位的起始index
 */
private int getNearCode(String content) {
    return NumberUtils.max(StringUtils.lastIndexOf(content, COLON_STRING), StringUtils.lastIndexOf(content, BLANK_STRING));
}