Ad
  • Default User Avatar

    The problem is that you are creating new Strings every iteration of the inner for loop. When Java creates a new String it copies the contents of the old Strings into the new String.