Iz E-študij, proste zakladnice študentskega znanja
public class SortiranjeObjektov{
public static void straightinsertion(Element[] a, byte smer, byte atr){
int i,j;
Element x;
for (i=1; i<a.length; ++i){
x=a[i];
for (j=i-1; j>=0 && x.manjsi(a[j], smer, atr); --j)
a[j+1]=a[j];
a[j+1]=x;
}
}
}