Android examples for java.lang:Integer
get Mini Positive Number
import java.util.Arrays; public class Main { public static int getMiniPositiveNum(int... num) { if (num == null || num.length == 0) { return -1;//from w w w. j av a2s .c o m } int result = -1; Arrays.sort(num); for (int i = 0; i < num.length; i++) { if (num[i] >= 0) { result = num[i]; break; } } return result; } }