code: static public byte[] getBytes(String input) {
  
          if (null != input) {
              int length = input.length();
              byte[] output = new byte[length];
              for (int i = 0; i < length; i++) {
                  output[i] = (byte) input.charAt(i);
              }
              return output;
          }
          return null;
      }
docs: Simple utility to get the bytes from a String but handle a
  null String as well.
  
  @param input
  @return byte[]