Here you can find the source of getDaysOfWeekNames(Locale l, int len)
Parameter | Description |
---|---|
l | locale |
len | must be SHORT or LONG |
public static String[] getDaysOfWeekNames(Locale l, int len)
//package com.java2s; import static java.util.Calendar.*; import java.text.DateFormatSymbols; import java.util.Calendar; import java.util.Locale; public class Main { /**/*w w w .ja v a 2 s . c om*/ * @param l locale * @param len must be SHORT or LONG * @return Names of the day of the week in locale dependent order. First day has index 1. Index 0 has nothing. */ public static String[] getDaysOfWeekNames(Locale l, int len) { String[] s; if (len == SHORT) s = new DateFormatSymbols(l).getShortWeekdays(); else s = new DateFormatSymbols(l).getWeekdays(); int firstDay = Calendar.getInstance().getFirstDayOfWeek(); if (firstDay != 1) { String[] buf = new String[8]; int n = 8 - firstDay; System.arraycopy(s, firstDay, buf, 1, n); System.arraycopy(s, 1, buf, n + 1, 7 - n); s = buf; } return s; } public static String[] getDaysOfWeekNames() { return getDaysOfWeekNames(Locale.getDefault(), LONG); } }