SHARE
TWEET

Untitled

a guest Mar 24th, 2019 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     public String decode(String k) {
  2.        
  3.         StringBuilder input1 = new StringBuilder();
  4.         input1.append(k);
  5.         input1 = input1.reverse();
  6.         char[] charA = input1.toString().toCharArray();
  7.         int[] numericVect = new int[charA.length];
  8.         StringBuilder result = new StringBuilder();
  9.  
  10.         for (int i = 0; i < charA.length; i++) {
  11.             numericVect[i] = Character.getNumericValue(charA[i]);
  12.         }
  13.  
  14.         int i = 0;
  15.         int number = 0;
  16.         while (i < charA.length){
  17.             number = numericVect[i] * 10 + numericVect[i+1];
  18.  
  19.             if (number == 32) {
  20.                 result.append((char) number);
  21.                 i += 2;
  22.                 continue;
  23.             }
  24.  
  25.             if ((number >= 65 && number <= 95) || (number >= 97 && number < 100)) {
  26.                 result.append((char)number);
  27.                 i += 2;
  28.                 continue;
  29.             }
  30.  
  31.             number = numericVect[i] * 100 + numericVect[i+1] * 10 + numericVect[i+2];
  32.             result.append((char)number);
  33.             i += 3;
  34.  
  35.         }
  36.  
  37.         return  result.toString();
  38.     }
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