static Object[] promotePrimitives(Object lhs,Object rhs){
  lhs=promoteToInteger(lhs);
  rhs=promoteToInteger(rhs);
  if ((lhs instanceof Number) && (rhs instanceof Number)) {
    Number lnum=(Number)lhs;
    Number rnum=(Number)rhs;
    boolean b;
    if ((b=(lnum instanceof Double)) || (rnum instanceof Double)) {
      if (b)       rhs=new Double(rnum.doubleValue());
 else       lhs=new Double(lnum.doubleValue());
    }
 else     if ((b=(lnum instanceof Float)) || (rnum instanceof Float)) {
      if (b)       rhs=new Float(rnum.floatValue());
 else       lhs=new Float(lnum.floatValue());
    }
 else     if ((b=(lnum instanceof Long)) || (rnum instanceof Long)) {
      if (b)       rhs=new Long(rnum.longValue());
 else       lhs=new Long(lnum.longValue());
    }
  }
  return new Object[]{lhs,rhs};
}

static Object [ ] promotePrimitives ( Object lhs , Object rhs ) { lhs = promoteToInteger ( lhs ) ; rhs = promoteToInteger ( rhs ) ; if ( ( lhs instanceof Number ) && ( rhs instanceof Number ) ) { Number lnum = ( Number ) lhs ; Number rnum = ( Number ) rhs ; boolean b ; if ( ( b = ( lnum instanceof Double ) ) || ( rnum instanceof Double ) ) { if ( b ) rhs = new Double ( rnum . doubleValue ( ) ) ; else lhs = new Double ( lnum . doubleValue ( ) ) ; } else if ( ( b = ( lnum instanceof Float ) ) || ( rnum instanceof Float ) ) { if ( b ) rhs = new Float ( rnum . floatValue ( ) ) ; else lhs = new Float ( lnum . floatValue ( ) ) ; } else if ( ( b = ( lnum instanceof Long ) ) || ( rnum instanceof Long ) ) { if ( b ) rhs = new Long ( rnum . longValue ( ) ) ; else lhs = new Long ( lnum . longValue ( ) ) ; } } return new Object [ ] { lhs , rhs } ; }
promote the pair of primitives to the maximum type of the two . e . g . [ int , long ] - > [ long , long ]
