Singleton pattern for sorts in java backend

ready for review
I don't like that you have both Sort and KSorts containing Sort constants?