Created
September 17, 2019 15:12
-
-
Save youngjinmo/bcb44efe4e4bd585334008ddccc2faf3 to your computer and use it in GitHub Desktop.
문자열 알파벳 순서대로 정렬
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Arrays; | |
public class quizTest_03 { | |
public static String orderByAscii(String str){ | |
String[] temp = str.split(""); | |
Arrays.sort(temp); | |
String change = ""; | |
for (int i = 0; i < temp.length; i++) { | |
change += temp[i]; | |
} | |
return change; | |
} | |
public static void main(String[] args) { | |
String data = "Hello World"; | |
System.out.println(orderByAscii(data)); | |
// HWdellloor | |
System.out.println(orderByAscii(data).length()); | |
// 11 | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment