So I have an android application and frequent forced close. Why on my logcat the following Method often causes errors?
static void solveTSP(int[][] valuesMatrix) {
shortestDistance = Integer.MAX_VALUE;
longestDistance = Integer.MIN_VALUE;
shortestPath = null;
int totalPlaces = valuesMatrix.length;
ArrayList<Integer> places = new ArrayList<>();
for(int i=0; i<totalPlaces; i++){
places.add(i);
}
int startPlace = places.get(0);// in logcat, this line is the cause of the Index error Out of Bounds Exception: Invalid index 0, size is 0. How does that happen?
int currentDistance = 0;
bruteForceSearch(valuesMatrix, places, startPlace, currentDistance);
}