Here you can find the source of maxValueInRemainingListElements(String[] numberList, int initialIndex)
Parameter | Description |
---|---|
numberList | The list of individual numbers |
initialIndex | The index of the first number to start checking onwards from |
private static int maxValueInRemainingListElements(String[] numberList, int initialIndex)
//package com.java2s; //file LICENSE in the root of the DomainHealth distribution. public class Main { /**//w ww .j a va 2s . c o m * For an array of numbers, finds the max individual value from these * numbers. For example if the input is "12,1,2,0,5" and initial index is * 3, will find the highest number from "0,5" which is "5". If there are * no numbers found, returns 0. * * @param numberList The list of individual numbers * @param initialIndex The index of the first number to start checking onwards from * @return The maximum number found in the list, from position of the initial index */ private static int maxValueInRemainingListElements(String[] numberList, int initialIndex) { int maxVal = 0; int index = initialIndex; while (index < numberList.length) { if (numberList[index].length() > 0) { maxVal = Math.max(maxVal, Integer.parseInt(numberList[index])); } index += 1; } return maxVal; } }