Solved AbsDistincs in java