random identifier generator java code example Example: java generate random id String id = UUID.randomUUID().toString();