added test in java showing that it works for the problem input