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

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&lt;number.length;k++){ System.out.print(number[k] + &quot; &quot;); } System.out.println(); } }...
View Full Document

Ask a homework question - tutors are online