public static void main(String[] args) { int arr[]={-4,-3,56,34,76,34,23,4,75,87,50,3,5,6,}; int min = arr[0]; int sec = arr[1]; int temp; if (min>sec){ temp = min ; min = sec; sec = temp; } for (int i = 3; i < arr.length; i++) { if (arr[i]<min){ sec = min; min = arr[i]; }else if (arr[i]>min&&arr[i]<sec){ sec = arr[i]; } } System.out.println(sec); }