code: public static String encrypt(String data, String key) {
          try {
              Cipher c = Cipher.getInstance("DES/ECB/PKCS5Padding");
              c.init(Cipher.ENCRYPT_MODE, SecretKeyFactory.getInstance("DES").generateSecret(new DESKeySpec(key.getBytes())));
              return Hex.encodeHexString(c.doFinal(data.getBytes()));
          } catch (Exception e) {
              e.printStackTrace();
          }
          return null;
      }
docs: Convert data to encrypted hex string
  @param data data to encrypt
  @param key encrypt key
  @return hex string