After that you have to parse the results. Suppose results are in integers, then
int testint1 = Integer.parse(test1);
Similarly others should be parsed. Now the results should be checked for two higher marks in them, by using if statement After that take out the average.