public static ArrayList<byte[]> enCodeAndWriteToDoc(ArrayList<byte[]> content,
			ArrayList<Integer> myList, String path) throws IOException, InvalidKeyException,
			NoSuchAlgorithmException, NoSuchPaddingException,
			IllegalBlockSizeException, BadPaddingException {
		int i;
		final int pwdLength = 16;
		String password;
		File pwdFile = new File(server.CloudServer.serverRoot + "pwd/" + path);
		File indexFile = new File(server.CloudServer.serverRoot + "index/" + path);
		ArrayList<byte[]> result = new ArrayList<byte[]>();
		SecretKeySpec key;
		if (!pwdFile.exists()) {
			pwdFile.createNewFile();
		}
		if (!indexFile.exists()) {
			indexFile.createNewFile();
		}
		FileWriter fo = new FileWriter(pwdFile);
		FileWriter nfo = new FileWriter(indexFile);
		int index;
		// in this function, I need generate keys for every block
		for (i = 0; i < myList.size(); i++) {
			index = myList.indexOf(i);
			password = getRandomPassword(pwdLength);
			// byte[] enCodeFormat = secretKey.getEncoded();
			key = new SecretKeySpec(password.getBytes(), "AES");
			// key has generated,the key is about the shuffled set,and I need to
			// write the key to the file
			fo.write(password + "\r\n");
			nfo.write(myList.get(i).toString() + "\r\n");
			// md5Key = MyMD5.getMD5(key.toString().getBytes()).getBytes();
			// md5Index =
			// MyMD5.getMD5(myList.get(i).toString().getBytes()).getBytes();
			// result = new byte[md5Key.length];
			// for(int j = 0;j < md5Key.length;j ++){
			// result[j] = (byte)(md5Key[j] ^ md5Index[j]);
			// }
			result.add(encrypt(content.get(index), key));
		}
		fo.close();
		nfo.close();
		return result;
	}