title: Convert string to hex
body: <p>I have to update the date and time of a time clock in a dynamic way. I am not able to convert a string to a format accepted by the variable char (not char array).</p>
  
  <p>Is there another way? </p>
  
  <p>Thus that's there works! But not so dynamic ... </p>
  
  <pre><code>char year = 0x0E;
  char month = 0x0A;
  char day = 0x0A;
  char hour = 0x0A;
  char min = 0x0A;
  char sec = 0x0A;
  
  byte[] date_hour = new byte[]{(byte) 0xFE, (byte) 0x82, (byte) 0x71, (byte) 0x00, (byte) 0x0B, 
                     (byte) 0x01, (byte) 0x00, (byte) 0x07, 
                     (byte) year, (byte) month, (byte) day, (byte) hour, (byte) min, (byte) sec, 
                     (byte) 0x0A, (byte) 0x17, (byte) 0x0E, (byte) 0x0A, (byte) 0x17};
  
  out.write(date_hour);
  </code></pre>
  
  <p>I wanted something like: </p>
  
  <pre><code>public String getYear() {
      return year;
  }
  
  //gets...
  
  char year = getYear();
  char month = getMont();
  char day = getDay();
  char hour = getHour();
  char min = getMin();
  char sec = getSec();
  
  byte[] date_hour = new byte[]{(byte) 0xFE, (byte) 0x82, (byte) 0x71, (byte) 0x00, (byte) 0x0B, 
                     (byte) 0x01, (byte) 0x00, (byte) 0x07, 
                     (byte) year, (byte) month, (byte) day, (byte) hour, (byte) min, (byte) sec, 
                     (byte) 0x0A, (byte) 0x17, (byte) 0x0E, (byte) 0x0A, (byte) 0x17};
  
  out.write(date_hour);
  </code></pre>
  
  <p>I tried: 
  <a href="https://stackoverflow.com/questions/6650650/hex-encoded-string-to-byte-array">Hex-encoded String to Byte Array</a>
  <a href="https://stackoverflow.com/questions/7853502/how-to-convert-parse-from-string-to-char-in-java">How to convert/parse from String to char in java?</a></p>
  
  <p>Sorry for my bad english ...
  Thanks!</p>