title: How to use String methods to swap 0's and 1's inside a string
body: <p>I am currently working on a problem for my high school computer programing course that asks: A string contains only '0' and '1' characters and spaces. Write a method that takes such a string and makes and returns a "negative" string in which all the 0s are replaced with 1s and all the 1s with 0s. Your method must rely only on String's methods and not use any explicit iterations or recursion.</p>
  
  <pre><code>public static String negativeBits(String s)
  {
      String answer = s.replaceAll("0", "1");
      answer = s.replaceAll("1", "0");
      return answer;
  }
  </code></pre>
  
  <p>So I was thinking I can use the replaceAll function to do this, but then realized that the flaw is that it changes everything to 1's first, and then to 0s. I am not sure as to how to change my code so that it swaps the numbers.
  Thank You,
  Eager Coder </p>