[Solved] How to store an integer variable as an input in character array in Java?


    String str = "aaabbcc";
    char c;
    ArrayList<String>count=new ArrayList();

    for(int i = 0; i < str.length(); i++){
    if(!count.contains(str.charAt(i)+"")){
    count.add(str.charAt(i)+"");
    }
    }

int [] dd = new int [count.size()];

    for (int i = 0; i < str.length(); i++) {
    c=str.charAt(i);
       for(int j=0;j<count.size();j++){
           if(count.get(j).equals(c+"")){
               dd[j]++;
           }
       }
    }

    String newS="";
    for(int i=0;i<count.size();i++){
        newS+=count.get(i)+dd[i];
    }

str = newS;

    System.out.println(str);

solved How to store an integer variable as an input in character array in Java?