Java tutorial
//package com.java2s; import java.util.ArrayList; public class Main { public static ArrayList<Integer> includeWeek(String week, String weekLine) { weekLine = weekLine.trim(); ArrayList<Integer> result = new ArrayList<>(); String[] ss = weekLine.split("@"); for (int i = 0; i < ss.length; i++) { String[] s1 = ss[i].split("-"); if (s1.length == 1 && s1[0].trim().substring(0, s1[0].trim().length() - 1).trim().equals(week)) { result.add(i); } else if (s1.length == 2 && Integer.valueOf(s1[0].trim()) <= Integer.valueOf(week.trim()) && Integer .valueOf(s1[1].substring(0, s1[1].length() - 1).trim()) >= Integer.valueOf(week.trim())) { result.add(i); } } return result; } }