@Override
	public int compareTo(bean1 o) {
		if(sal > o.sal) return -1;
		else if(sal < o.sal) return 1;
		else	return 0;
	}
	
}

// advanced comparison using iterator
class BeanComparator implements Comparator<bean1>
{
	
	public int compare(bean1 o1, bean1 o2) {
		
		if(o1.sal > o2.sal)
			return -1;
		else if (o1.sal < o2.sal)
			return 1;
		else
			return 0;
		
	}