Skip to content

Instantly share code, notes, and snippets.

@ykrsm
Last active January 29, 2018 17:05
Show Gist options
  • Save ykrsm/8a0d10034f78116f30bd1db799da2a89 to your computer and use it in GitHub Desktop.
Save ykrsm/8a0d10034f78116f30bd1db799da2a89 to your computer and use it in GitHub Desktop.
Things I learned

what does “>>>” mean in java?

https://stackoverflow.com/questions/19058859/what-does-mean-in-java

maximum and minimum values for numeric types

Integer.MIN_VALUE: -2147483648 == -2^31
Integer.MAX_VALUE: 2147483647 == 2^31-1
Float.MIN_VALUE: 1.4E-45 == 2^-149
Float.MAX_VALUE: 3.4028235E38 === (2-2^-23)·2^127
Double.MIN_VALUE: 4.9E-324 == 2^-1074
Double.MAX_VALUE: 1.7976931348623157E308 == (2-2^52)*2^1023
Boolean.TRUE: true
Boolean.FALSE: false

Why java does not autobox int[] to Integer[]

The difference is int[] is itself an Object, whereas Integer[] is an array of references to Integer object. https://stackoverflow.com/questions/19508844/why-java-does-not-autobox-int-to-integer

Isolate the lowest set bit in x

x & ~(x − 1) (00101100)2 becomes (00000100)2

Erase the lowest set bit in x

x & (x − 1) (00101100)2 becomes (00101000)2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment