Code example for Random

Methods: nextBytesnextInt

    public static final String UNIQUE_QUALIFIER = "unique-qualifier";
    private final static Random rand = new Random();
    private static byte[] randomBytes() { 
        final byte[] bytes = new byte[rand.nextInt(100)];
        return bytes;
    public static XATransactionId createXID(final int formatId, String uniqueQualifier) {
        final byte[] branchQualifier = randomBytes();
        final byte[] globalTransactionId = randomBytes();
        final XATransactionId xid =
                new XATransactionId(formatId, branchQualifier, globalTransactionId, uniqueQualifier);
        return xid;
Connect your IDE to all the code out there  Get Codota for Java