
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException
for (int i = 0; i < size; i++) { for (int j = i; j < size; j++) {   
   distances[i][j] = haversin(coords[i][0], coords[j][0], coords[i][1], 
   coords[j][1]); distances[j][i] = distances[i][j]; } } long start = 
   System.nanoTime(); int[] shortestPath = nearestNeighbour(distances); double 
   bestShort = 0; for (int i = 0; i < size; ++i) {bestShort += 
   distances[shortestPath[i] - 1][shortestPath[i + 1] - 1]; } bestShort += 
   distances[shortestPath[size - 1]][shortestPath[0]]; 
}
 
     
    