int
Reveals Its Inner Nature
The Inner Int applet, included below, lets you experiment with the two's-complement format of integers in the Java virtual machine. This applet accompanies Chapter 12, "Integer Arithmetic," of Inside the Java 2 Virtual Machine. A few key-press sequences that illustrate interesting characteristics of two's-complement numbers are given below: After Max Comes Min
Max ++, --, ++, --, ... This key-press sequence yields overflow when you press either of the Min Magnitude Greater Than Max
Min *=-1, *=-1, *=-1,... Because the magnitude of the smallest (negative) Click here to view a page of links to the source code of the Inner Int applet. |
Copyright © 1996-1999 Bill Venners. All Rights Reserved. |