Code example for ByteArrayOutputStream

Methods: toByteArray

0
     * Generates a device- and invocation-specific seed to be mixed into the 
     * Linux PRNG. 
     */ 
    private static byte[] generateSeed() { 
        try { 
            ByteArrayOutputStream seedBuffer = new ByteArrayOutputStream();
            DataOutputStream seedBufferOut =
                    new DataOutputStream(seedBuffer);
            seedBufferOut.writeLong(System.currentTimeMillis());
            seedBufferOut.writeLong(System.nanoTime());
            seedBufferOut.writeInt(Process.myPid());
            seedBufferOut.writeInt(Process.myUid());
            seedBufferOut.write(BUILD_FINGERPRINT_AND_DEVICE_SERIAL);
            seedBufferOut.close();
            return seedBuffer.toByteArray();
        } catch (IOException e) {
            throw new SecurityException("Failed to generate seed", e);
        } 
    } 
 
Connect your IDE to all the code out there  Get Codota for Java