MCPcopy Create free account
hub / github.com/DuGuQiuBai/Java / main

Method main

day14/code/day14_Regex/src/cn/itcast_03/RegexTest.java:17–45  ·  view source on GitHub ↗
(String[] args)

Source from the content-addressed store, hash-verified

15 */
16public class RegexTest {
17 public static void main(String[] args) {
18 // ����һ���ַ���
19 String s = "91 27 46 38 50";
20
21 // ���տո���зָ��ַ������õ�һ���ַ�������
22 String[] strArray = s.split(" ");
23
24 // ���ַ�������ת��Ϊ��������
25 int[] arr = new int[strArray.length];
26 for (int x = 0; x < arr.length; x++) {
27 arr[x] = Integer.parseInt(strArray[x]);
28 }
29
30 // �����������������
31 Arrays.sort(arr);
32
33 // ����������������ת�����ַ���
34 StringBuilder sb = new StringBuilder();
35 for (int x = 0; x < arr.length; x++) {
36 if (x == arr.length - 1) {
37 sb.append(arr[x]);
38 } else {
39 sb.append(arr[x]).append(" ");
40 }
41 }
42 String result = sb.toString();
43
44 System.out.println(result);
45 }
46}

Callers

nothing calls this directly

Calls 1

toStringMethod · 0.45

Tested by

no test coverage detected