code: private void replaceData(byte[] data, String findText, String replaceText, boolean unicode)
     {
        boolean replaced = false;
        byte[] findBytes = getBytes(findText, unicode);
        byte[] replaceBytes = getBytes(replaceText, unicode);
        int endIndex = data.length - findBytes.length;
        for (int index = 0; index <= endIndex; index++)
        {
           if (compareBytes(findBytes, data, index))
           {
              System.arraycopy(replaceBytes, 0, data, index, replaceBytes.length);
              index += replaceBytes.length;
              System.out.println(findText + " -> " + replaceText);
              replaced = true;
           }
        }
        if (!replaced)
        {
           System.out.println("Failed to find " + findText);
        }
     }
docs: For a given find/replace pair, iterate through the supplied block of data
  and perform a find and replace.
  
  @param data data block
  @param findText text to find
  @param replaceText replacement text
  @param unicode true if text is double byte