import java.io.*; import java.util.Arrays; public class fusuche { public static void main(String[] args) { int[] zahlen = new int[100]; for(int i = 0; i < zahlen.length; i++) { zahlen[i] = (int)(Math.random() * 99); } System.out.println(); printzahlen(sortieren(zahlen)); } public static int[] sortieren(int[] n) { int[] h = new int[max(n) + 1]; for(int i = 0; i < h.length; i++) h[i] = 0; for(int i = 0; i < n.length; i++) h[n[i]]++; int pos = 0; for(int i = 0; i < h.length; i++) { for(int f = 0; f < h[i]; f++) { n[pos] = i; pos++; } } return n; } public static void printzahlen(int[] n) { System.out.print("["); for(int i = 0; i< n.length; i++) { System.out.print(n[i] + ((i == n.length - 1)? "" : ", ")); } System.out.print("]"); } public static int max(int[] n) { int max = n[0]; for(int i = 0; i < n.length; i++) { if(n[i] > max) max = n[i]; } return max; } }