Since you mentioned unit tests, here's an example unit test that proves your code does not work:
@Test public void testFindIndicesThrowsException() { ClassName x = new ClassName(); try { int[] result = x.findIndices("Name", "age", "FieldThatDoesNotExist", "Phone"); fail("expected exception was not thrown!"); } catch (IllegalArgumentException exception) { assertEquals("One or more of input arguments could not be found in the headers.", exception.getMessage()); } } Explanation: You are setting a boolean in a loop. This means it could be set to false on one iteration, then set to true on the next.
Since you are throwing an exception anyway, you could throw it right away, or set your boolean & break out of the loop.