Ad
Code
Diff
  • import java.util.Arrays;
    
    public class MaxNumber {
        public static long print(long number) {
            
            String numeroString = String.valueOf(number);
    
            char[] digitos = numeroString.toCharArray();
            Arrays.sort(digitos);
    
            StringBuilder stringBuilder = new StringBuilder(new String(digitos));
            stringBuilder.reverse();
          
            number = Long.parseLong(stringBuilder.toString());
            return number;
        }
    }
    • import java.util.Arrays;
    • public class MaxNumber {
    • public static long print(long number) {
    • return number
    • String numeroString = String.valueOf(number);
    • char[] digitos = numeroString.toCharArray();
    • Arrays.sort(digitos);
    • StringBuilder stringBuilder = new StringBuilder(new String(digitos));
    • stringBuilder.reverse();
    • number = Long.parseLong(stringBuilder.toString());
    • return number;
    • }
    • }