Introduction - If you have any usage issues, please Google them yourself
public static String encode(String in, String key) throws InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException, IllegalBlockSizeException, BadPaddingException {
String hex = "";
byte[] bytIn = in.getBytes();
SecretKeySpec skeySpec = new SecretKeySpec(key.getBytes(), "AES");
Cipher cipher = Cipher.getInstance("AES");
cipher.init(Cipher.ENCRYPT_MODE, skeySpec);
byte[] bytOut = cipher.doFinal(bytIn);
hex = byte2hexString(bytOut);
return hex;
}