Last updated by Roedy Green ©1996-1999 Canadian Mind Products.
Stuck in a frame? Click here to break out.
Because RAM necessarily comes in modules sizes of even powers of two, the prefix scheme was modified for measuring bytes by even powers of two. Unfortunately, vendors use the binary scheme for measuring RAM capacity but the decimal scheme for measuring hard disk capacity. I suspect they do this primarily to inflate the apparent disk capacity by 7%, and because their competitors also do this, rather than as protest against the heretic binary RAM byte measuring prefix convention.
prefix | American English | Standard
Decimal Multiplier | Power of 10 | Byte
Measure Multiplier | Byte Measure Power of 2 |
---|---|---|---|---|---|
exa | quintillion (British trillion) | 1,000,000,000,000,000,000 | 1018 | 1,152,921,504,606,846,976 | 260 |
peta | quadrillion | 1,000,000,000,000,000 | 1015 | 1,125,899,906,842,624 | 250 |
tera | trillion (British billion) | 1,000,000,000,000 | 1012 | 1,099,511,627,776 | 240 |
giga | billion | 1,000,000,000 | 109 | 1,073,741,824 | 230 |
mega | million | 1,000,000 | 106 | 1,048,576 | 220 |
kilo | thousand | 1000 | 103 | 1024 | 210 |
hecto | hundred | 100 | 102 | ||
deca | ten | 10 | 100 | ||
deci | tenth | 1/10 | 10-1 | ||
centi | hundredth | 1/100 | 10-2 | ||
milli | thousandth | 1/1000 | 10-3 | ||
micro | millionth | 1/1,000,000 | 10-6 | ||
nano | billionth | 1/1,000,000,000 | 10-9 | ||
pico | trillionth (British billionth) | 1/1,000,000,000,000 | 10-12 | ||
femto | quadrillionth | 1/1,000,000,000,000,000 | 10-15 | ||
atto | quintillionth (British trillionth) | 1/1,000,000,000,000,000,000 | 10-18 |
Extension | Mime Type | Notes |
---|---|---|
aif aiff aifc | audio/x-aiff | sound |
au snd | audio/basic | standard Internet/Java wave sound |
avi | video/x-msvideo | avi movie |
bas | text/plain | Basic source |
bin exe | application/octet-stream | executable program |
bmp | image/bmp | Windows image |
doc | application/msword | Microsoft Word document formatted. |
etx | text/x-setext | |
evy | application/envoy | Envoy |
gif | image/gif | standard Internet icon image |
gz | application/x-gzip | tar gzip |
html htm | text/html | HTML, web browser |
ief | image/ief | image |
jpeg jpg jpe | image/jpeg | stardard Internet photo image |
js | application/x-javascript | JavaScript |
mid | audio/midi | Crescendo MIDI sound |
mov qt | video/quicktime | Quicktime movie player |
movie | video/x-sgi-movie | movie |
mpg mpeg mpe | video/mpeg | mpeg movie player |
oda | application/oda | |
pbm | image/x-portable-bitmap | bitmap image |
application/pdf | Adobe Acrobat Portable Document Format | |
pgm | image/x-portable-graymap | grayscale image |
ppm | image/x-portable-pixmap | pixel image |
ps eps ai | application/postscript | Adobe PostScript, encapsulated PostScript |
ra rm ram | audio/x-pn-realaudio | Real Audio |
rgb | image/x-rgb | image |
rtf | application/rtf | rich text format |
rtx | text/richtext | rich text |
ssi shtml
(htm html) |
text/x-server-parsed-html | server side includes; web server expands embedded commands. Sometimes htm and html files are parsed for embedded commands too. |
tar | application/x-tar | Unix tar archive |
tiff tif | image/tiff | image |
tsv | text/tab-separated-values | tab separated list |
txt text | text/plain | text |
vew | application/groupwise | Novell GroupWise |
w61 | application/wordperfect6.1 | WordPerfect |
wav | audio/wav | Microsoft wave sound |
wav | audio/x-wav | Microsoft wave sound |
wp wpd wp5 | application/wordperfect | WordPerfect 5 |
w60 | application/wordperfect6.0 | Worderfect 6 |
zip | application/x-zip-compressed | WinZip |
In Java you take the remainder with the % operator. In Java, the sign of the remainder follows the dividend, not the divisor. Be especially careful when corralling random numbers into a smaller range. Java division does have the Euclidean property. When you multiply the quotient by the divisor and add the remainder you get back to the dividend. Java division is truncated division.
Floored division is what you normally want when trying to figure out which bin an item belongs in. You can compute floored division as:
if (dividend >= 0) ? (dividend / divisor) : ((dividend-divisor+1) / divisor);
For computing how many fixed-size bins you need to contain N items, you want ceiled division, also known as the covered quotient. You can compute the covered quotient as:
if (dividend >= 0) ? ((dividend+divisor-1) / divisor) : (dividend / divisor);
Signs | Division | Modulus |
---|---|---|
+ + | +7/+4=+1 | +7%+4=+3 |
- + | -7/+4=-1 | -7%+4=-3 |
+ - | +7/-4=-1 | +7%-4=+3 |
- - | -7/-4=+1 | -7%-4=-3 |
![]() |
![]() |
![]() | |
![]() |
Canadian Mind Products | You can get an updated copy of this page from http://mindprod.com/jglossm.html | The Mining Company's
Focus on Java Best of the Net Award |