Created
January 22, 2019 09:38
-
-
Save zeraf29/c13202f2bc6b3cd52ff94ee2c493df6e to your computer and use it in GitHub Desktop.
getStringPoint.java
This file contains hidden or 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
public class Kata { | |
public static String high(String s) { | |
String bitWords = ""; | |
int bitWordsPoint = 0; | |
String[] words = s.split(" "); | |
int tempPoint = 0; | |
for(String word : words) { | |
tempPoint = getWordsPoint(word.toLowerCase()); | |
if(bitWordsPoint <= tempPoint) { | |
bitWordsPoint = tempPoint; | |
bitWords = word.toLowerCase(); | |
} | |
} | |
return bitWords; | |
} | |
private static int getWordsPoint(String word) { | |
int point = 0; | |
for(int i=0; i<word.length(); i++) { | |
point += (word.charAt(i)-96); | |
} | |
return point; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Stream 사용법 고민해보기