static int pick(int[] peaches) { int length = peaches.length,maxSize = 0; int[] incSize = new int[length]; for (int i = 0; i < length; i++) incSize[i] = 1; for (int i = 1; i < length; i++) for (int j = 0; j < i; j++) if (peaches[j] <= peaches[i]) { incSize[i] = Math.max(incSize[j] + 1, incSize[i]); maxSize = Math.max(incSize[i], maxSize); } return maxSize; }