Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Converts a list of treeIds from a string to an integer array
- * @param treeIds : list of tree ids seperated by commas
- * @return : integer array of tree ids
- */
- private int[] getTreeIDs(String treeIds) {
- treeIds = treeIds.trim(); // remove any white space from the list of ids
- final String [] trees = treeIds.split(","); // create a seperate string for each tree id that is seperated by a ','
- final int [] tree_ids = new int [trees.length]; // create an integer array to store the tree ids
- for(int i = 0; i < trees.length; i++) {
- // iterate through the array of tree id strings and convert them to integers and place them inside the tree id integer array
- tree_ids[i] = Integer.parseInt(trees[i]);
- }
- return tree_ids;
- }
Add Comment
Please, Sign In to add comment