However, I am stumped on the last bit. Any suggestions on which line of code needs to be corrected?
I presume lines 54 thru 60 need TLC.
Thanks ;)

package com.codegym.task.task04.task0441;
/*
Somehow average
*/
import java.util.ArrayList;
import java.util.Scanner;
public class Solution {
public static void main(String[] args) throws Exception {
//write your code here
Scanner scanner = new Scanner(System.in);
int[] nums = new int[3];
int middle = 0;
int max = 0;
int min = 0;
for (int i = 0; i < nums.length; i++) {
nums[i] = scanner.nextInt();
}
if (nums[0] >= nums[1] && nums[0] >= nums[2]) {
max = nums[0];
}
if (nums[1] <= nums[2] && nums[2] >= nums[0]) {
max = nums[2];
}
if (nums[2] <= nums[1] && nums[1] >= nums[0]) {
max = nums[1];
}
if (nums[0] < nums[1] && nums[0] < nums[2]){
min = nums[0];
}
if (nums[1] < nums[0] && nums[1] < nums[2]){
min = nums[1];
}
if (nums[2] < nums[0] && nums[2] < nums[1]){
min = nums[2];
}
if (nums[0] < max && nums[0] > min)
middle = nums[0];
if (nums[1] < max && nums[1] > min)
middle = nums[1];
if (nums[2] < max && nums[2] > min)
middle = nums[2];
if (nums[0] == nums[2] && nums[0] != nums[1])
middle = nums[0];
if (nums[1] == nums[2] && nums[1] != nums[0])
middle = nums[1];
if (nums[2] == nums[0] && nums[2] != nums[1])
middle = nums[2];
if (middle == max || nums[0] == nums[1] || nums[1] == nums[2]) {
middle = nums[0];
}
System.out.println(middle);
}
}

/**Posting a solution is prohibited*/This code should work, bassically what I did here is I put all elements in vector and sorted it, so for example if numbers were 1,3,2 it became 1,2,3 and then outputed the second number P.S. You might have to import class containing vector