Reputation: 807
I sometimes see code like this:
int length = 0x8FFFFFF; //128MB
byte buf = new byte[length];
It does not make much sense to me as:
0x8FFFFFF = 150,994,943
128MB = 128 * 1024 * 1024 byte = 134,217,728 byte
These two number does not equal. What am I missing here?
Thanks,
Upvotes: 2
Views: 5469
Reputation: 799082
Someone previously had a 7
there but changed it to a 8
in order to avoid an off-by-one error, but forgot to change the rest to 0
.
Upvotes: 6