Java implementation and notes