java random primary key code example Example: java random primary key String id = UUID.randomUUID().toString();