Question: ```
int array[] = new int[]{10, 11, 88, 2, 12, 9};

public static int getMax(int[] inputArray){ 
  int maxValue = inputArray[0];

  for(int i=1;i < inputArray.length;i++){ 
     if(inputArray[i] > maxValue){ 
        maxValue = inputArray[i]; 
     } 
  } 
  return maxValue; 
}

```

Is there any way to find the maximum value but lower than 88 in the array?

Answer: 
If you use Java8, you can use the [Streaming API](https://docs.oracle.com/javase/8/docs/api/java/util/stream/Stream.html):

```
int[] array = new int[]{10, 11, 88, 2, 12, 9};
final int limit = 88;
Optional<Integer> max = Arrays.stream(array).filter(i -> i < limit)
    .boxed().max(Comparator.naturalOrder());

System.out.println("Biggest element smaller than " + limit + " is " + max.get());

```

*Output:*

```
Biggest element smaller than 88 is 12 

```

It does the following:

* converts the `int` array to a stream
* removes elements from the stream that are greater or equal to the specified limit (`.filter`)
* converts the stream to an `Integer` stream (`.boxed`)
* calculates the maximum using the natural order comparator (`.max`)

The key part of the stream is the `filter` where the elements that are greater than the limit are removed from the stream.

UPDATE: If the index is also needed

```
List<Integer> intList = Arrays.asList(0, 11, 88, 2, 12, 9);
final int limit = 88;
IntStream.range(0, intList.size())
        .filter(i -> intList.get(i) < limit)
        .boxed().max(Comparator.comparing(intList::get))
        .ifPresent(resultIndex -> System.out.println("Index " + resultIndex + ", value " + intList.get(resultIndex)));

```
You're probably looking for something like this: 

```
public static int getMax(final int[] inputArray) {

    final int L = 88;

    int maxValue = inputArray[0];

    for (int i = 1; i < inputArray.length; i++) {
        if (maxValue < L)
            break;
        maxValue = inputArray[i];
    }

    for (final int element : inputArray) {
        if (element >= L)
            continue;
        if (element > maxValue)
            maxValue = element;
    }
    return maxValue;
}

```

Please be aware that the (some of the) other answers fail if `inputArray[0] >= 88`.