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