it has been 8 years since I last programmed, and then it was just basics for a networking degree. I am writing a basic program to start my way back into java programming. the program is dealing with binary numbers stored as strings.
e.g. 01101110010
I have got everything else working, but now I want to swap all "1" for "0" and all "0" for "1"
to get 10010001101
The problem is the only way I know to swap chars is to create a new string with the chars replaced but I can only do one char at a time and then I just end up with a string of all 1s or 0s
so I thought about using a char array and trying to swap each char in the array but I have no idea how to go about this.