Java Version of sequence_fix
Java Version of sequence_fix