@Test public void testGetIndexWeekdays() throws Exception { final String lang = Locale.getDefault().getLanguage(); int[] indexWeekdays = DateHelper.getIndexWeekdays(); if (lang.equals("ru")) { assertEquals(2, indexWeekdays[0]); assertEquals(3, indexWeekdays[1]); assertEquals(4, indexWeekdays[2]); assertEquals(5, indexWeekdays[3]); assertEquals(6, indexWeekdays[4]); assertEquals(7, indexWeekdays[5]); assertEquals(1, indexWeekdays[6]); } else if (lang.equals("en")) { assertEquals(1, indexWeekdays[0]); assertEquals(2, indexWeekdays[1]); assertEquals(3, indexWeekdays[2]); assertEquals(4, indexWeekdays[3]); assertEquals(5, indexWeekdays[4]); assertEquals(6, indexWeekdays[5]); assertEquals(7, indexWeekdays[6]); } else { fail("No test, set unknown locale"); } }
public static int[] getIndexWeekdays() { int firstDay = Calendar.getInstance().getFirstDayOfWeek(); int[] dayWeek = new int[7]; for (int i = 0; i < 7; i++) { dayWeek[i] = firstDay++; if (firstDay > 7) firstDay = 1; } return dayWeek; }
DateHelper { public static int[] getIndexWeekdays() { int firstDay = Calendar.getInstance().getFirstDayOfWeek(); int[] dayWeek = new int[7]; for (int i = 0; i < 7; i++) { dayWeek[i] = firstDay++; if (firstDay > 7) firstDay = 1; } return dayWeek; } }
DateHelper { public static int[] getIndexWeekdays() { int firstDay = Calendar.getInstance().getFirstDayOfWeek(); int[] dayWeek = new int[7]; for (int i = 0; i < 7; i++) { dayWeek[i] = firstDay++; if (firstDay > 7) firstDay = 1; } return dayWeek; } private  DateHelper(); }
DateHelper { public static int[] getIndexWeekdays() { int firstDay = Calendar.getInstance().getFirstDayOfWeek(); int[] dayWeek = new int[7]; for (int i = 0; i < 7; i++) { dayWeek[i] = firstDay++; if (firstDay > 7) firstDay = 1; } return dayWeek; } private  DateHelper(); static String format(Date dt); static String format(Date dt, String pattern); static String formatShortDate(Date dt); static String formatShortTime(Date dt); static String formatISO8601(Date dt); static Calendar getEmptyCalendar(); static Calendar calendar(int year, int month, int day); static Date date(int year, int month, int day); static Date beginOfDay(Date dt); static Date endOfDay(Date dt); static int diffDays(Date dtEnd, Date dtBegin); static Date setTime(Date date, Date time); static Date getTime(Date datetime); static boolean isOnlyTime(Date dt); static boolean isOnlyDate(Date dt); static Date addDays(Date date, int count); static boolean isEmpty(Date date); static String[] getWeekdays(); static String[] getShortWeekdays(); static int[] getIndexWeekdays(); }
DateHelper { public static int[] getIndexWeekdays() { int firstDay = Calendar.getInstance().getFirstDayOfWeek(); int[] dayWeek = new int[7]; for (int i = 0; i < 7; i++) { dayWeek[i] = firstDay++; if (firstDay > 7) firstDay = 1; } return dayWeek; } private  DateHelper(); static String format(Date dt); static String format(Date dt, String pattern); static String formatShortDate(Date dt); static String formatShortTime(Date dt); static String formatISO8601(Date dt); static Calendar getEmptyCalendar(); static Calendar calendar(int year, int month, int day); static Date date(int year, int month, int day); static Date beginOfDay(Date dt); static Date endOfDay(Date dt); static int diffDays(Date dtEnd, Date dtBegin); static Date setTime(Date date, Date time); static Date getTime(Date datetime); static boolean isOnlyTime(Date dt); static boolean isOnlyDate(Date dt); static Date addDays(Date date, int count); static boolean isEmpty(Date date); static String[] getWeekdays(); static String[] getShortWeekdays(); static int[] getIndexWeekdays(); static final String DATE_FORMAT_ISO8601; }