Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static String asArray(String value) {
- final StringBuilder output = new StringBuilder();
- char a[] = (value + "\0").toCharArray();
- int i, m, j;
- for (i = 0; a[i] != '\0'; i++) {
- m = 1;
- for (j = 0; a[j] != '\0'; j++) {
- if (j >= i)
- if (a[j] == a[j + 1]) {
- m++;
- } else {
- break;
- }
- }
- output.append(String.valueOf(a[i])).append(m);
- i = i + m - 1;
- }
- return output.toString();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement