| 6 | *�������abcdefg�� |
| 7 | */ |
| 8 | public class ArrayDemo { |
| 9 | public static void main(String[] args) { |
| 10 | // �����ַ��� |
| 11 | String s = "dacgebf"; |
| 12 | |
| 13 | // ���ַ���ת���ַ����� |
| 14 | char[] chs = s.toCharArray(); |
| 15 | |
| 16 | // ���ַ������������ |
| 17 | bubbleSort(chs); |
| 18 | |
| 19 | // ���������ַ�����ת���ַ��� |
| 20 | String result = String.valueOf(chs); |
| 21 | |
| 22 | System.out.println(result); |
| 23 | } |
| 24 | |
| 25 | public static void bubbleSort(char[] chs) { |
| 26 | for (int x = 0; x < chs.length - 1; x++) { |
| 27 | for (int y = 0; y < chs.length - 1 - x; y++) { |
| 28 | if (chs[y] > chs[y + 1]) { |
| 29 | char temp = chs[y]; |
| 30 | chs[y] = chs[y + 1]; |
| 31 | chs[y + 1] = temp; |
| 32 | } |
| 33 | } |
| 34 | } |
| 35 | } |
| 36 | } |
nothing calls this directly
no outgoing calls
no test coverage detected