Adding my Java implementation