Reprinted from: http://blog.csdn.net/jinwufeiyang/article/details/52201039
1. NumberUtils tool class /* 1.NumberUtils.isNumber(): Determine whether the string is a number */ NumberUtils.isNumber("5.96"); // The result is true NumberUtils.isNumber("s5"); // The result is false NumberUtils.isNumber("0000000000596"); // The result is true /* 2.NumberUtils.isDigits(): Determine whether the string is full of numbers */ NumberUtils.isDigits("0000000000.596"); // false NumberUtils.isDigits("0000000000596"); // true /* 3.NumberUtils.toInt(): convert string to integer */ NumberUtils.toInt("5"); NumberUtils.toLong("5"); NumberUtils.toByte("3"); NumberUtils.toFloat("3.2"); NumberUtils.toDouble("4"); NumberUtils.toShort("3"); /* 4.NumberUtils.max(): Find the largest one */ NumberUtils.max(newint[]{3,5,6}); // The result is 6 NumberUtils.max(3,1,7); / / result is 7 /* 5.NumberUtils.min(): Find the smallest one */ NumberUtils.min(newint[]{3,5,6}); // The result is 6 NumberUtils.min(3,1,7); / / result is 7 /* 6.NumberUtils.createBigDecimal() creates a BigDecimal type from a string, supports long, int, float, double, number and other values */ NumberUtils.createBigDecimal("1"); NumberUtils.createLong("1"); NumberUtils.createInteger("1"); 2. ArrayUtils tool class /* 1.ArrayUtils.isEmpty(strs): Determine whether the array is empty, if it is not empty, return false, if it is empty, true */ ArrayUtils.isEmpty( new String[]{"21","Yes"} ); // result is false ArrayUtils.isEmpty( new String[]{""}); // result is false ArrayUtils.isEmpty( new String[]{ null }); // result is false ArrayUtils.isEmpty( new String []{}); // result is true /* 2.ArrayUtils.isNotEmpty(strs): Determine whether the array is not empty, return true if not empty, false if empty */ ArrayUtils.isNotEmpty( new String[]{"21","Yes"}); // The result is true ArrayUtils.isNotEmpty( new String[]{""}); // The result is true ArrayUtils.isNotEmpty( new String[]{}); // The result is false /* 3.ArrayUtils.isSameLength(strs, strs2): Determine whether the lengths of the two arrays are equal, return true if the lengths are equal, otherwise return false. The two array types being compared must be the same */ ArrayUtils.isSameLength( new String[]{"21","Yes"}, new String[]{"21","Yes"}); // return false /* 4. ArrayUtils.isSameType(strs, strs2): Determine whether the types of the two arrays are the same, return true if they are the same, otherwise return false */ ArrayUtils.isSameType( new String[]{"21","Yes"},newInteger []{3}); /* 5.ArrayUtils.isEquals(strs,strs2) Determine whether two arrays are equal */ ArrayUtils.isEquals(strs,strs); // The result is true /* 6.ArrayUtils.toString() converts an array to String for printing */ ArrayUtils.toString( new String[]{"21","Yes"}); // The result is: {21,Yes} /* 7.ArrayUtils.clone assignment (clone) array */ Object[]s=ArrayUtils.clone(newObject[]{"33","yy"}); /* 8. ArrayUtils.subarray intercepts the subarray: according to the start index startIndexInclusive to the end index startIndexInclusive */ Object[]s1=ArrayUtils.subarray(newObject[]{"33","yy","uu"},0, 1); // The result is the returned array: [33] Object[]s2=ArrayUtils.subarray(newObject[]{"33","yy","uu"},0,2); // The result is the returned array : [33,yy] /* 9.ArrayUtils.indexOf query the position of an object in the array, but specify the starting search position */ intindex=ArrayUtils.indexOf(newObject[]{"33","yy","uu"},"uu "); // result is 2 intindex1=ArrayUtils.indexOf(newObject[]{"33","yy","uu"},"uu",2); // result is 2 intindex3=ArrayUtils.indexOf(newObject []{"33","yy","uu"},"uu",3); // The result is -1 /* 10.ArrayUtils.lastIndexOf reverse query the position of an object in the array, you can specify the starting search position */ intindex11=ArrayUtils.lastIndexOf(newObject[]{"33","yy","uu"}, "33"); // result is 0 intindex22=ArrayUtils.lastIndexOf(newObject[]{"33","yy","uu"},"33",2); /* 11.ArrayUtils.contains query whether an object is in the array */ ArrayUtils.contains( new String[]{"1", "2", "3"}, "11"); /* 12.ArrayUtils.reverse reverses the array */ ArrayUtils.reverse( new String[]{"22","yy"}); // The result is: {"yy","22"} /* 13.ArrayUtils.add adds an object to the array */ String[] t={"22","yy"}; String[] gg=(String[])ArrayUtils.add(t,"jj");//{"22","yy","jj"} /* 14.ArrayUtils.addAll merges two arrays */ String[]ggo=(String[])ArrayUtils.addAll( new String[]{"22","yy"}, new String[]{"jj"} ); // result is: [22,yy,jj] ArrayUtils.addAll( new String[]{"22","yy"}, new String[]{"jj", "jj"}); // result is: [22,yy,jj,jj] /* 15.ArrayUtils.remove deletes an element at a certain position in the array */ String[]gg4=(String[])ArrayUtils.remove( new String[]{"22","yy"},1); /* 16.ArrayUtils.removeElement deletes an object in the array */ String[]ggpp=(String[])ArrayUtils.removeElement( new String[]{"22","yy"},"yy"); 3. RandomUtils tool class RandomUtils helps us generate random numbers, not only numeric types, but also boolean types can be generated by RandomUtils, and RandomStringUtils generates character random numbers. RandomUtils.nextBoolean(); RandomUtils.nextDouble(); RandomUtils.nextLong(); // Note that the parameter passed in here is not a random seed, but a random number between 0 and 1000. RandomUtils.nextInt(1000);