title: How can I convert a String into ArrayList by counting occurrence of each characters?
body: <p>I have a Input String as :</p>
  
  <pre><code>String str="1,1,2,2,2,1,3";
  </code></pre>
  
  <p>I want count each id occurrence and store them into List,and I want output Like this:</p>
  
  <pre><code> [
    {
     "count": "3",
      "ids": "1, 2"
     }
     {
       "count": "1",
        "ids": "3"
      }
        ]
  </code></pre>
  
  <p>I tried by using <code>org.springframework.util.StringUtils.countOccurrencesOf(input, "a");</code> like this. But after counting not getting the things like I want.</p>