add java solution for longestlines