Created
December 28, 2015 13:22
-
-
Save Yur-ok/801cbb20775fd90d7002 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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