Calculate the difference between the ``maximum integer value'' and the ``minimum integer value'' that can be obtained by rearranging the numbers of each digit for a positive integer value of 4 digits or less to create the next integer value. For a positive integer value of 4 digits or less, if you repeat the operation to create the next integer value by calculating the difference between the "maximum integer value" and the "minimum integer value" that can be obtained by rearranging the numbers of each digit , always converges to some integer value. Enter a positive integer value n of 4 or fewer digits in the command line input. Create a program that repeats the above calculation and outputs the integer values until convergence to the standard output.

`import java.util.Scanner; public class Main{ public static void main(String[] args){ int a,b,c,d,x,y,z; int min,max; Scanner sc = new Scanner(System.in); a = sc.nextInt(); b = a/1000; c = (a/100)%10; d = (a/10)%10; x = a%10; int[] array = {b,c,d,x}; java.util.Arrays.sort(array); min = array[0]*1000+array[1]*100+array[2]*10+array[3]; max = array[3]*1000+array[2]*100+array[1]*10+array[0]; while(true){ if(max - min == 6174){ System.out.println(max); break;`