Created
February 24, 2016 15:32
-
-
Save abbath0767/11b9c1b79c20ed4188c9 to your computer and use it in GitHub Desktop.
7 kyu Sort the Gift Code
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 GiftSorter{ | |
public String sortGiftCode(String code){ | |
String[] arrayOfSymbol = code.split(""); | |
Arrays.sort(arrayOfSymbol); | |
StringBuilder sb = new StringBuilder(); | |
for (String oneSymbol: arrayOfSymbol) | |
sb.append(oneSymbol); | |
return sb.toString(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment