(String str)
| 32 | } |
| 33 | |
| 34 | public static String compressBad(String str) { |
| 35 | int size = countCompression(str); |
| 36 | if (size >= str.length()) { |
| 37 | return str; |
| 38 | } |
| 39 | String mystr = ""; |
| 40 | char last = str.charAt(0); |
| 41 | int count = 1; |
| 42 | for (int i = 1; i < str.length(); i++) { |
| 43 | if (str.charAt(i) == last) { |
| 44 | count++; |
| 45 | } else { |
| 46 | mystr += last + "" + count; |
| 47 | last = str.charAt(i); |
| 48 | count = 1; |
| 49 | } |
| 50 | } |
| 51 | return mystr + last + count; |
| 52 | } |
| 53 | |
| 54 | public static String compressBetter(String str) { |
| 55 | int size = countCompression(str); |
nothing calls this directly
no test coverage detected