I want to calculate the sum of all odd array indexes, but I\'m having some trouble finding the right way to do it.
Here\'s my code so far:
String id
String id = "9506265088085"; int[] intArray = new int[strArray.length]; int sum = 0; for (int i = 1; i < id.length(); i+=2) { sum += Integer.parseInt(String.valueOf(id.charAt(i))); } System.out.println(sum);