Q- Can you store all of the possible (Java) byte numbers on your laptop memory?
A- Probably yes. To build the answer, let's follow these steps:
1- How much memory 1 byte uses in Java?
8 bits (= 2^3 bits).
Please check this post and this one on a new window.
2- How many possible representations of numbers in byte are available in Java?
256 (=2 ^ 8) possibilities, which can vary between -2^7 and +2^7 -1.
Please check the reference on a new window.
3- How much memory is needed to store all the possible representations of numbers in byte?
2 K bits or 256 bytes (256 x 8 bits = 2^8 * 2^3 = 2^[8+3] = 2^ 11 bits).
4- How much memory is available on your laptop?
I don't know, but you probably have enough!
http://interviewqa4java.blogspot.com/2014/02/how-many-bytes-are-in-1-gb.html
A- Probably yes. To build the answer, let's follow these steps:
1- How much memory 1 byte uses in Java?
8 bits (= 2^3 bits).
Please check this post and this one on a new window.
2- How many possible representations of numbers in byte are available in Java?
256 (=2 ^ 8) possibilities, which can vary between -2^7 and +2^7 -1.
Please check the reference on a new window.
3- How much memory is needed to store all the possible representations of numbers in byte?
2 K bits or 256 bytes (256 x 8 bits = 2^8 * 2^3 = 2^[8+3] = 2^ 11 bits).
4- How much memory is available on your laptop?
I don't know, but you probably have enough!
http://interviewqa4java.blogspot.com/2014/02/how-many-bytes-are-in-1-gb.html