function equals(obj) {
  //--com.ibm.icu.math.BigDecimal rhs;
  var rhs;
  //--int i=0;
  var i=0;
  //--char lca[]=null;
  var lca=null;
  //--char rca[]=null;
  var rca=null;
  // We are equal iff toString of both are exactly the same
  if (obj==null)
   return false; // not equal
  if ((!(((obj instanceof BigDecimal)))))
   return false; // not a decimal
  rhs=obj; // cast; we know it will work
  if (this.ind!=rhs.ind)
   return false; // different signs never match
  if (((this.mant.length==rhs.mant.length)&&(this.exp==rhs.exp))&&(this.form==rhs.form))

   { // mantissas say all
    // here with equal-length byte arrays to compare
    {var $8=this.mant.length;i=0;i:for(;$8>0;$8--,i++){
     if (this.mant[i]!=rhs.mant[i])
      return false;
     }
    }/*i*/
   }
  else
   { // need proper layout
    lca=this.layout(); // layout to character array
    rca=rhs.layout();
    if (lca.length!=rca.length)
     return false; // mismatch
    // here with equal-length character arrays to compare
    {var $9=lca.length;i=0;i:for(;$9>0;$9--,i++){
     if (lca[i]!=rca[i])
      return false;
     }
    }/*i*/
   }
  return true; // arrays have identical content
  }
Compares this <code>BigDecimal</code> with <code>rhs</code> for
equality.
<p>
If the parameter is <code>null</code>, or is not an instance of the
BigDecimal type, or is not exactly equal to the current
<code>BigDecimal</code> object, then <i>false</i> is returned.
Otherwise, <i>true</i> is returned.
<p>
"Exactly equal", here, means that the <code>String</code>
representations of the <code>BigDecimal</code> numbers are
identical (they have the same characters in the same sequence).
<p>
The {@link #compareTo(BigDecimal, MathContext)} method should be
used for more general comparisons.
@param  rhs The <code>Object</code> for the right hand side of
            the comparison.
@return     A <code>boolean</code> whose value <i>true</i> if and
            only if the operands have identical string representations.
@throws ClassCastException if <code>rhs</code> cannot be cast to
                a <code>BigDecimal</code> object.
@stable ICU 2.0
@see    #compareTo(Object)
@see    #compareTo(BigDecimal)
@see    #compareTo(BigDecimal, MathContext)