Skip to content

Instantly share code, notes, and snippets.

@Yur-ok
Created December 28, 2015 13:22
Show Gist options
  • Save Yur-ok/801cbb20775fd90d7002 to your computer and use it in GitHub Desktop.
Save Yur-ok/801cbb20775fd90d7002 to your computer and use it in GitHub Desktop.
package Lesson3.KeyPoint3;
/**
* Created by Юрий on 28.12.2015.
*/
public class longGetPopulation {
public static void main(String[] args) {
String[][] population = {{"China", "Peking", "1354040000"}, {"India", "New Delhi", "1210569573"},
{"USA", "Washington", "316305000"}, {"Indonesia", "Jakarta", "237641326"},
{"Brazil", "Brasilia", "193946886"}, {"Pakistan", "Islamabad", "183748060"}};
System.out.println(getPopulation(population));
}
static long getPopulation(String[][] data) {
long num = 0;
for (int i = 0, j = 2; i <= data.length - 1; i++) {
num += Long.valueOf(data[i][j]);
}
return num;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment