Choose based on the range you need — saves memory.
byte — whole numbers from -128 to 127. Use instead of int when value is guaranteed within that range, to save memory.
short — whole numbers from -32 768 to 32 767.
int — whole numbers from -2 147 483 648 to 2 147 483 647. Default choice for numeric variables.
long — whole numbers from -9.2×10¹⁸ to 9.2×10¹⁸. Used when int isn’t large enough. End the literal with "L".
float / double — fractional numbers. Suffix with "f" (float) or "d" (double). float has ~6–7 decimal digits of precision; double has ~16. Prefer double for most calculations.
Casting
Widening (automatic):byte → short → char → int → long → float → double
Narrowing (manual):double → float → long → int → char → short → byte