Pattern cigarparser = Pattern.compile("(\\d+)([SMHDI])");
Matcher m= cigarparser.matcher(cigar);
ArrayList<CigarEntry> ci=new ArrayList<CigarEntry>();
while(m.find())
{
int count = Integer.getInteger(m.group(1));
String key = m.group(2);
ci.add(new CigarEntry(count,key));
}
 
return ci;