daily pastebin goal
25%
SHARE
TWEET

Untitled

a guest Jan 22nd, 2019 73 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public class Kata {
  2.  
  3.   public static String high(String s) {
  4.     String bitWords = "";
  5.         int bitWordsPoint = 0;
  6.        
  7.         String[] words = s.split(" ");
  8.     int tempPoint = 0;
  9.         for(String word : words) {
  10.       tempPoint = getWordsPoint(word.toLowerCase());
  11.             if(bitWordsPoint <= tempPoint) {
  12.                 bitWordsPoint = tempPoint;
  13.                 bitWords = word.toLowerCase();
  14.             }
  15.         }
  16.     return bitWords;
  17.   }
  18.  
  19.   private static int getWordsPoint(String word) {
  20.         int point = 0;
  21.         for(int i=0; i<word.length(); i++) {
  22.             point += (word.charAt(i)-96);
  23.         }
  24.         return point;
  25.     }
  26.  
  27. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top