24 << 8
means shifting the number 24
to the left for 8 bits, which is equivalent to 24 * (2^8) = 6144
.
In the provided code snippet, it encodes a time hh:mm
into an integer hh << 8 + mm
.
Since there are 24 hours in one day, the array to represent the activity of every minute in one day requires (24 << 8) + 1
elements. The +1
is to make the array index for 24:00
legal.
7
solved Java Code Explain [closed]