Java removes duplicate characters