Sorting - temp=number[i number[i]=number[j number[j]=temp...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
public class Sorting{ public static void main(String args[]){ int[] number = {4,2,6,1,0,7,5}; int temp = 0; for(int i=0;i<5;i++){ for(int j=i+1;j<5;j++){ if(number[i]>number[j]){
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: temp=number[i]; number[i]=number[j]; number[j]=temp; } } } for(int k=0;k<number.length;k++){ System.out.print(number[k] + " "); } System.out.println(); } }...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online