title: Replace byte array occurrence that contains `0x00` to the `0x30`
body: <p>I am trying to replace byte array occurrence that contains <code>0x00</code> to the <code>0x30</code>.</p>
  
  <p>1) <strong><em>If byte array is in <code>string</code> form. (Do-able)</em></strong></p>
  
  <pre><code> String bytes = "0x7d 0x44 0x14 0x05 0x0e 0x01 0x11 0x04 0x2b 0x0c 0x00 0x45";
  
   if(bytes.contains("0x00"))
      bytes = bytes.replace("0x00", "0x30");
  </code></pre>
  
  <p>2) <strong><em>If byte array is in <code>byte</code> form. (Problematic)</em></strong></p>
  
  <pre><code>byte[] bytes = new byte[] { (byte) 0x7d,  (byte) 0x44,  
                 (byte)0x2d,  (byte)0x05,  (byte) 0x0e,  (byte)0x01,  
                 (byte)0x11,  (byte)0x10,  (byte)0x2f,  (byte) 0x03,  
                 (byte)0x00,  (byte)0x48};
  
  try 
  {
      String myString = new String(bytes, "US-ASCII").trim();
  
      if(myString.contains("0x00"))
      {
          myString = myString.replace("0x00", "0x30");
          bytes = myString.getBytes();
      }
  } 
  catch (UnsupportedEncodingException e) 
  {
      e.printStackTrace();
  }
  </code></pre>
  
  <p>The above method requires to first convert bytes into string form and then replace all the occurences of <code>0x00</code> with <code>0x30</code> and then convert the resultant string back to bytes.
  This seems something not upto the mark. However, despite of that the solution didn't worked.</p>