package com.sksort; public class insert_straight { public static void main(String[] args) { int a[] = {100,6,3,6,0,2,5}; insert_straight s = new insert_straight(); s.sort(a); s.show(a); } public void sort(int a[]) { int temp,j; for(int i=1;i<a.length;++i){ temp = a[i]; for(j=i;j>0;--j){ if(a[j-1]<temp) break; a[j] = a[j-1]; } a[j] = temp; } } public void show(int a[]) { for (int i = 0; i < a.length; i++) { if (i == 0) System.out.print(a[i]); else System.out.print(" " + a[i]); } System.out.println(); } }