question: public int compare ( Object o1 , Object o2 ) { if ( o1 == null ) throw new IllegalArgumentException ( "o1 = null" ) ; if ( o2 == null ) throw new IllegalArgumentException ( "o2 = null" ) ; MRfQResponseLineQty q1 = null ; MRfQResponseLineQty q2 = null ; if ( o1 instanceof MRfQResponseLineQty ) q1 = ( MRfQResponseLineQty ) o1 ; else throw new ClassCastException ( "o1" ) ; if ( o2 instanceof MRfQResponseLineQty ) q2 = ( MRfQResponseLineQty ) o2 ; else throw new ClassCastException ( "o2" ) ; if ( ! q1 . isValidAmt ( ) ) return - 99 ; if ( ! q2 . isValidAmt ( ) ) return + 99 ; BigDecimal net1 = q1 . getNetAmt ( ) ; if ( net1 == null ) return - 9 ; BigDecimal net2 = q2 . getNetAmt ( ) ; if ( net2 == null ) return + 9 ; return net1 . compareTo ( net2 ) ; }
target:  Compare based on net amount