Skip to content

Instantly share code, notes, and snippets.

@arinto
Last active August 29, 2015 14:01
Show Gist options
  • Save arinto/d734e8da2b94510995b0 to your computer and use it in GitHub Desktop.
Save arinto/d734e8da2b94510995b0 to your computer and use it in GitHub Desktop.
Numbers that every Java programmers and developers should know!

Java numbers..

that every Java programmers/developers should know. Feel free to contribute by forking and pull requests! :bowtie:

###Size of primitive data types

  • byte: 1 byte, 8-bit signed two's complement, default 0
  • short: 2 bytes, 16-bit signed two's complement, default 0
  • int: 4 bytes, 32-bit signed two's complement, default 0
  • long: 8 bytes, 64-bit signed two's complement, default 0L
  • float: 4 bytes, 32-bit, default 0.0f
  • double: 8 bytes, 64-bit, default 0.0d
  • boolean: undefined, default false
  • char: 2 bytes, 16-bit, default '\u0000'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment