document.write('
Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. import java.util.Scanner;
  2.  
  3. public class nrp5213100155 {
  4.      public static void main(String[]args){
  5.          abjad uji = new abjad();
  6.      }    
  7. }
  8.  
  9. class abjad{
  10.     public Scanner me = new Scanner (System.in);
  11.     int array [];
  12.     String huruf;
  13.  
  14.     private void rumus (){
  15.      for (int i=0;i<huruf.length()-1;i++){      
  16.        if (huruf.charAt(i)==\',\')            //agar dapat menerima input berupa tanda koma (,)
  17.        huruf = huruf.substring(0,i) + huruf.substring (i+1);    //memisah angka dan huruf
  18.      }  
  19.     }
  20.     private void hola (){  
  21.        for (int i=0;i<huruf.length();i++){
  22.        if(huruf.codePointAt(i)>=49&&huruf.codePointAt(i)<=57)
  23.        array[i]=(huruf.codePointAt(i))*2+97;        //Input Angka  
  24.        else    
  25.        array[i]=(huruf.codePointAt(i))*2;
  26.     }
  27.   }
  28.   private void huhu(){
  29.       int temp;
  30.       for (int i=huruf.length()-1;i>0;i--){     //buublesort
  31.           for (int x=0;x<i;x++){
  32.               if(array[i]<array[x]){
  33.               temp = array[i];
  34.               array[i]=array[x];
  35.               array[x]=temp;    
  36.         }
  37.        }
  38.      }
  39.    }    
  40.    private void info(){
  41.       char temp;
  42.       for (int i = 0; i < huruf.length(); i++) {
  43.             if(array[i]%2==0)
  44.                 temp = (char) (array[i]/2);
  45.             else
  46.                 temp = (char) ((array[i]-97)/2);
  47.             if(i!=huruf.length()-1)
  48.                 System.out.print(temp+",");
  49.             else
  50.                 System.out.println(temp);
  51.   }  
  52.  }      
  53.     abjad(){
  54.     System.out.print("Inputan : ");
  55.     huruf  = me.nextLine();
  56.     rumus();
  57.     array = new int[huruf.length()];        //output
  58.     hola();  
  59.     huhu();
  60.     System.out.print("Hasil Pengurutan : ");
  61.     info();
  62.   }    
  63.  }
');