fork(1) download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. int num = 8756404;
  13. int[] times = new int[10];
  14. while(true){
  15. if(num==0){
  16. break;
  17. }
  18. int val = num%10;
  19. times[val]++;
  20. num /= 10;
  21. }
  22. for(int i=9; i>=0; i--){
  23. for(int j=0; j<times[i]; j++){
  24. System.out.print(i);
  25. }
  26. }
  27. System.out.println();
  28. }
  29. }
Success #stdin #stdout 0.09s 320320KB
stdin
Standard input is empty
stdout
8765440