code: public void setValue(String name, String value) {
          byte[] bytes = value.getBytes(StandardCharsets.UTF_16LE);
          int newLength = bytes.length+2; // for 0 padding
          byte[] with0 = new byte[newLength];
          System.arraycopy(bytes, 0, with0, 0, newLength);
          check(Advapi32.INSTANCE.RegSetValueEx(handle, name, 0, WINNT.REG_SZ, with0, with0.length));
      }
docs: Writes a String value.