udunits/src/main/java/ucar/units/Dimension.java
protected Factor[] mult(final Dimension that) {
        // relys on _factors always sorted
        final Factor[] factors1 = _factors;
        final Factor[] factors2 = that._factors;
        int i1 = 0;
        int i2 = 0;
        int k = 0;
        Factor[] newFactors = new Factor[factors1.length + factors2.length];
        for (;;) {
            if (i1 == factors1.length) {
                final int n = factors2.length - i2;
                System.arraycopy(factors2, i2, newFactors, k, n);
                k += n;
                break;
            }
            if (i2 == factors2.length) {
                final int n = factors1.length - i1;
                System.arraycopy(factors1, i1, newFactors, k, n);
                k += n;
                break;
            }
            final Factor f1 = factors1[i1];
            final Factor f2 = factors2[i2];
            final int comp = f1.getID().compareTo(f2.getID());
            if (comp < 0) {
                newFactors[k++] = f1;
                i1++;
            }
            else if (comp == 0) {
                final int exponent = f1.getExponent() + f2.getExponent();
                if (exponent != 0) {
                    newFactors[k++] = new Factor(f1, exponent);
                }
                i1++;
                i2++;
            }
            else {
                newFactors[k++] = f2;
                i2++;
            }
        }
        if (k < newFactors.length) {
            final Factor[] tmp = new Factor[k];
            System.arraycopy(newFactors, 0, tmp, 0, k);
            newFactors = tmp;
        }
        return newFactors;
    }
protected Factor[] mult(final Dimension that) {
        // relys on _factors always sorted
        final Factor[] factors1 = _factors;
        final Factor[] factors2 = that._factors;
        int i1 = 0;
        int i2 = 0;
        int k = 0;
        Factor[] newFactors = new Factor[factors1.length + factors2.length];
        for (;;) {
            if (i1 == factors1.length) {
                final int n = factors2.length - i2;
                System.arraycopy(factors2, i2, newFactors, k, n);
                k += n;
                break;
            }
            if (i2 == factors2.length) {
                final int n = factors1.length - i1;
                System.arraycopy(factors1, i1, newFactors, k, n);
                k += n;
                break;
            }
            final Factor f1 = factors1[i1];
            final Factor f2 = factors2[i2];
            final int comp = f1.getID().compareTo(f2.getID());
            if (comp < 0) {
                newFactors[k++] = f1;
                i1++;
            }
            else if (comp == 0) {
                final int exponent = f1.getExponent() + f2.getExponent();
                if (exponent != 0) {
                    newFactors[k++] = new Factor(f1, exponent);
                }
                i1++;
                i2++;
            }
            else {
                newFactors[k++] = f2;
                i2++;
            }
        }
        if (k < newFactors.length) {
            final Factor[] tmp = new Factor[k];
            System.arraycopy(newFactors, 0, tmp, 0, k);
            newFactors = tmp;
        }
        return newFactors;
    }
protected Factor [ ] mult ( final Dimension that ) { // relys on _factors always sorted final Factor [ ] factors1 = _factors ; final Factor [ ] factors2 = that . _factors ; int i1 = 0 ; int i2 = 0 ; int k = 0 ; Factor [ ] newFactors = new Factor [ factors1 . length + factors2 . length ] ; for ( ; ; ) { if ( i1 == factors1 . length ) { final int n = factors2 . length - i2 ; System . arraycopy ( factors2 , i2 , newFactors , k , n ) ; k += n ; break ; } if ( i2 == factors2 . length ) { final int n = factors1 . length - i1 ; System . arraycopy ( factors1 , i1 , newFactors , k , n ) ; k += n ; break ; } final Factor f1 = factors1 [ i1 ] ; final Factor f2 = factors2 [ i2 ] ; final int comp = f1 . getID ( ) . compareTo ( f2 . getID ( ) ) ; if ( comp < 0 ) { newFactors [ k ++ ] = f1 ; i1 ++ ; } else if ( comp == 0 ) { final int exponent = f1 . getExponent ( ) + f2 . getExponent ( ) ; if ( exponent != 0 ) { newFactors [ k ++ ] = new Factor ( f1 , exponent ) ; } i1 ++ ; i2 ++ ; } else { newFactors [ k ++ ] = f2 ; i2 ++ ; } } if ( k < newFactors . length ) { final Factor [ ] tmp = new Factor [ k ] ; System . arraycopy ( newFactors , 0 , tmp , 0 , k ) ; newFactors = tmp ; } return newFactors ; }
Multiplies this dimension by another dimension.

@param that
The other dimension.
@return The product of the Factor-s of this dimension and the Factor-s of
the other dimension.
Multiplies this dimension by another dimension .