title: Special characters \0 {NUL} in Java
body: <p>How to replace \0 (NUL) in the String?</p>
  
  <pre><code>String b = "2012yyyy06mm";               // sth what i want
  String c = "2\0\0\0012yyyy06mm";
  String d = c.replaceAll("\\\\0", "");    // not work
  String e = d.replace("\0", "");          // er, the same
  System.out.println(c+"\n"+d+"\n"+e);
  
  String bb = "2012yyyy06mm";
  System.out.println(b.length() + " &gt; " +bb.length());  
  </code></pre>
  
  <p>The above code will print 12 > 11 in console. Oops, What happened?</p>
  
  <pre><code>String e = c.replace("\0", "");
  System.out.println(e);      // just print 2(a bad character)2yyyy06mm
  </code></pre>