code: public static byte[] encypt(String str, byte[] key) {
          byte[] b = null;
          try {
              SecretKey secretKey = new SecretKeySpec(key, "AES");
              Cipher cipher = Cipher.getInstance("AES");
              cipher.init(Cipher.ENCRYPT_MODE, secretKey);
              b = cipher.doFinal(str.getBytes());
          } catch (Exception e) {
              throw new RuntimeException(e);
          }
          return b;
      }
docs: 将一个字符串按指定key进行AES加密并返回字节数组
  
  @param str 需要加密的字符串
  @param key 指定key
  @return 返回字符串被加密后的字节数组，失败返回null