Conversion CMP Conversion Amanuensis

CMP home Amanuenses Menu no menu Last updated 2004-06-28 by Roedy Green ©1996-2004 Canadian Mind Products

This Applet will help you write Java code. Instead of memorising the 400 conversion functions between the 20 basic types, just use this amanuensis to generate the code, the paste it into your source.

This Applet requires one of the following up-to-date browsers:

Opera Opera 7.5 with the Java 1.4.2_04 Plug-in
Mozilla Mozilla 1.6 with the Java 1.4.2_04 Plug-in
Netscape Netscape 7.1 with the Java 1.4.2_04 Plug-in
IE Microsoft Internet Explorer 6.0.2800 with the Java 1.4.2_04 Plug-in
Get Java Sun's Java 1.4.2_04 Plug-in add on
Click the corresponding browser icon to download the latest browser software

details about the current version. download source and executable to run this Applet on your own machine as a stand-alone application.

If the Applet does not work for you, try the 20x20 matrix crib sheet

conversion table crib sheet for Java 1.4- ¤ conversion table crib sheet for Java 1.5+

Primitives

Primitive variables include boolean, char, byte, short, int, long, float and double. Strings, arrays and Objects are not considered primitives.
Type Signed? Bits Bytes Lowest Highest Mnemonic
boolean n/a 1 1 false true zero/one
char unsigned Unicode 16 2 '\u0000' [0] aka Character.MIN_VALUE '\uffff' [216-1] aka Character.MAX_VALUE Unicode chars are twice as big as C's.
byte signed 8 1 -128 [-27] aka Byte.MIN_VALUE +127 [27-1]aka Byte.MAX_VALUE Bytes are signed, so half the usual 255 range.
short signed 16 2 -32,768 [-215] aka Short.MIN_VALUE +32,767 [215-1] aka Short.MAX_VALUE 32K
int signed 32 4 -2,147,483,648 [-231] aka Integer.MIN_VALUE +2,147,483,647 [231-1] aka Integer.MAX_VALUE 2 gig
long signed 64 8 -9,223,372,036,854,775,808 [-263] aka Long.MIN_VALUE +9,223,372,036,854,775,807 [263-1] aka Long.MAX_VALUE 9 exabytes, or 9 billion gig
float signed exponent and mantissa 32 4 ±1.40129846432481707e-45 ±3.40282346638528860e+38
with 6 to 7 significant digits of accuracy.
rough float
double signed exponent and mantissa 64 8 ±4.94065645841246544e-324 ±1.79769313486231570e+308
with 14 to 15 significant digits of accuracy.
high precision float

Primitives vs Immutable Wrapper Objects

Contrast that table of primitives, with this table of basic Java types:
Mutable Primitives Immutable Objects
boolean Boolean
ordinary signed byte Byte
unsigned byte Byte
short Short
char Character
int Integer
long Long
float Float
double Double
char[] String

conversion table for Java 1.4- ¤ conversion table for Java 1.5+ ¤ conversion


CMP logo
CMP_home
home
Canadian Mind Products CSS
HTML Checked!
ICRA ratings logo
mindprod.com IP:[24.87.56.253]
Your IP:[80.134.30.163]
You are visitor number 41422.
Please send errors, omissions and suggestions
to improve this page to Roedy Green.
You can get a fresh copy of this page from: or possibly from your local J: drive mirror:
http://mindprod.com/converter.html J:\mindprod\converter.html