Given the following code snippet
SecureRandom generator = new SecureRandom();
byte[] randomBytes = new byte[6];
generator.nextBytes(randomBytes);
How many combinations are there? And how do you work it out?
My current thinking is that it works like the following
byte[6]
. creates an array of 6 bytes
. Each byte of 8 bits. So in total that has 256 combinations. 2^8
So if you expand that to 6 bytes then you can do 256^6
. 281,474,976,710,656
Have I got this right and answered my own question or have I missed something?
Aucun commentaire:
Enregistrer un commentaire