Package WZS. Sort; // sort the data in a base order // unify all the values to be compared (positive integers) into the same digit length, and add zero before the numbers with shorter digits. Then, sort the data by bit. // In this way, the sequence is changed to an ordered sequence after the ranking is completed from the ranking bit to the highest ranking. Import Java. util. arraylist; import Java. util. arrays; import Java. util. list; public class radixsort {public static void main (string [] ARGs) {int A [] = {49, 38, 65, 97, 76, 13, 27, 49, 78, 34, 12, 64, 5, 4, 62, 99, 98, 54,101, 56, 17, 18, 23, 34, 15, 35, 25, 53, 51}; sort (a); system. out. println ("sorted:" + arrays. tostring (a);} public static void sort (INT [] array) {// first determine the number of sorted partitions; int max = array [0]; for (INT I = 1; I <array. length; I ++) {If (array [I]> MAX) {max = array [I] ;}} int time = 0; // number of digits to be determined; while (max> 0) {max/= 10; time ++;} // create 10 queues; List <arraylist> queue = new arraylist <arraylist> (); for (INT I = 0; I <10; I ++) {arraylist <integer> queue1 = new arraylist <integer> (); queue. add (queue1);} // time allocation and collection; For (INT I = 0; I <time; I ++) {// array element allocation; for (Int J = 0; j <array. length; j ++) {// obtain the time + 1 digit of the number. Int x = array [J] % (INT) math. pow (10, I + 1)/(INT) math. pow (10, I); arraylist <integer> queue2 = queue. get (x); queue2.add (array [J]); queue. set (x, queue2);} int COUNT = 0; // element counter; // collect queue elements; For (int K = 0; k <10; k ++) {While (queue. get (k ). size ()> 0) {arraylist <integer> queue3 = queue. get (k); array [count] = queue3.get (0); queue3.remove (0); count ++ ;}}}}}