title: Java Database AutoIncrement Primary Key Algorithm
body: <p>I have a sqlite database with an autoincrement primary key which is interfaced through java. 
  For application reasons I can't use the auto generated primary key from the database so I need to create an id for each row in java. </p>
  
  <p>So my question is, is there an algorithm out there for java that I could follow for creating unique Integer ids for a database. </p>
  
  <p>I know I can just increment etc but I will need to use stuff like rollback, overflow and gap filling. </p>