Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Test {
- public static void main(String[] args){
- int[] numbers= new int[100];
- int position=0;
- while(position<100){
- numbers[position]=(int)(10000*Math.random());
- System.out.print(numbers[position]+" ");
- position=position+1;
- }
- System.out.println();
- //Tri et affichage
- tauscheZahlen(numbers,numbers.length);
- for(int i=0;i<numbers.length;i++)
- {
- System.out.print(numbers[i] + " ");
- }
- }
- public static void tauscheZahlen(int[] feld, int size){
- int i,j,temp;
- for(i=0;i<size;i++)
- {
- for(j=0;j<size-1;j++)
- {
- if(feld[j]>feld[j+1])
- {
- temp=feld[j];
- feld[j]=feld[j+1];
- feld[j+1]=temp;
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement