Java tutorial
//package com.java2s; //License from project: Open Source License import java.util.ArrayList; public class Main { public static final String OCCUPANT_IDS_DIVIDER = ","; public static ArrayList<Integer> getOccupantsIdsListFromString(String occupantIds) { ArrayList<Integer> occupantIdsList = new ArrayList<Integer>(); String[] occupantIdsArray = occupantIds.split(OCCUPANT_IDS_DIVIDER); for (String occupantId : occupantIdsArray) { occupantIdsList.add(Integer.valueOf(occupantId)); } return occupantIdsList; } }