go to previous page   go to home page   go to next page highlighting

Answer:

Data transfers from the network are much slower than from main memory and even slower than from hard disk.


divide() with negatives

Division with negative values works as with primitive ints (and as with paper-and-pencil arithmetic).

Two positive operands give a positive result. A single negative operand, either in numerator or denominator, gives a negative result. Two negative operands give a positive result.


+num.divide( +div ) == +result-num.divide( +div ) == -result
-num.divide( -div ) == +result+num.divide( -div ) == -result

Of course, you are eager to practice this right away! Mentally (or with scratch paper) decide on the value of each expression. Then click on the button to see the correct value.


BigInteger p12 = new BigInteger( "12" );
BigInteger n12 = p12.negate();

BigInteger p3 = new BigInteger( "3" );
BigInteger n3 = p3.negate();


Expression ? Result
System.out.println( p12.divide( p3 ) );
System.out.println( n12.divide( p3 ) );
System.out.println( p12.divide( n3 ) );
System.out.println( n12.divide( n3 ) );

QUESTION 13:

Using primitive ints, what is 5%3?


go to previous page   go to home page   go to next page