List of utility methods to do Byte Array Randomize
void | randomize(byte[] array) Fills an array with random values. Random rnd = new Random(System.currentTimeMillis()); int len = array.length; int count = (len / 8); int rest = (len - (count * 8)); int index = 0; for (index = 0; index < count; index += 8) { longAsLittleEnd(array, index, rnd.nextLong()); if (rest >= 4) { intAsLittleEnd(array, index, rnd.nextInt()); index += 4; rest -= 4; if (rest >= 2) { shortAsLittleEnd(array, index, (short) (rnd.nextInt() & 0x0000FFFF)); index += 2; rest -= 2; if (rest >= 1) { array[index] = (byte) (rnd.nextInt() & 0x000000FF); |