title: How to "shift" a collection/array of Strings?
body: <p>In my Android app i'm storing days of week in a database by creating a <code>String</code> from their numeric representation in the <code>Calendar</code> class.</p>
  
  <p>For example:</p>
  
  <ul>
  <li>All days: <code>"1234567"</code></li>
  <li>Monday and Tuesday: <code>"23"</code></li>
  <li>Monday, Wednesday, Friday: <code>"246"</code></li>
  </ul>
  
  <p>etc.</p>
  
  <p>I'd like to create a method that format these <code>String</code>s into the following format:</p>
  
  <ul>
  <li>Source String: <code>"1234567"</code>, formatted <code>String</code>: <code>"Mon Tue Wen Thu Fri Sat Sun"</code></li>
  <li>Source String: <code>"246"</code>, formatted <code>String</code>: <code>"Mon Wen Fri"</code></li>
  </ul>
  
  <p>So i came up with the following method:</p>
  
  <pre><code>// input is "1234567" for example
  public static String formatDays(String input) {
      List&lt;String&gt; dayStringList = new ArrayList&lt;&gt;(input.length());
      char[] days = input.toCharArray();
  
      for (char day : days) {
          dayStringList.add(DAY_MAP.get(Character.getNumericValue(day)));
      }
  
      return TextUtils.join(" ", dayStringList);
  }
  </code></pre>
  
  <p><code>DAY_MAP</code> looks like this:</p>
  
  <pre><code>Map&lt;Integer, String&gt; map = new HashMap&lt;&gt;(7);
  map.put(Calendar.MONDAY, "Mon");
  map.put(Calendar.TUESDAY, "Tue");
  map.put(Calendar.WEDNESDAY, "Wed");
  map.put(Calendar.THURSDAY, "Thu");
  map.put(Calendar.FRIDAY, "Fri");
  map.put(Calendar.SATURDAY, "Sat");
  map.put(Calendar.SUNDAY, "Sun");
  
  DAY_MAP = Collections.unmodifiableMap(map);
  </code></pre>
  
  <p>This works fine.</p>
  
  <p><strong>My problem</strong> is the representation of Sunday in <code>Calendar</code> is <code>1</code>, so for example, for the value <code>"1234567"</code> i'm getting the following formatted <code>String</code>: </p>
  
  <p><code>"Sun Mon Tue Wen Thu Fri Sat"</code></p>
  
  <p>instead of the following:</p>
  
  <p><code>"Mon Tue Wen Thu Fri Sat Sun"</code></p>
  
  <p>I have no idea how to address this issue, would appreciate any advice.</p>