public static ArrayList<byte[]> newGetHFromG(ArrayList<byte[]> gDoc){
		ArrayList<byte[]> returnBytes = new ArrayList<byte[]>();
		final int hBlockSize = 1024;
		int i,length,j,k;
		//j is column,8 bytes is a column
		byte[] buffer;
		if (gDoc.size() == 1){
			returnBytes.add(gDoc.get(gDoc.size()-1));
			return returnBytes;
		}
		
		buffer = new byte[hBlockSize];
		length = 0;
		for (j = 0;j < gDoc.get(0).length/8;j++){
			for (i = 0;i < gDoc.size()-1;i++){
				if (length == hBlockSize){
					returnBytes.add(buffer);
					length = 0;
					buffer = new byte[hBlockSize];
				}
				for (k = 0;k < 8;k++){
					try{
						buffer[length] = gDoc.get(i)[k+j*8];						
					}
					catch(Exception e){
						System.out.println(k);
						System.out.println(j);
						System.out.println(gDoc.get(0).length);
						System.out.println(i);
						System.out.println(gDoc.get(i).length);
						System.out.println(length);
					}
					length++;
				}
			}
		}
		if (length != hBlockSize){
			byte[] newBuffer = new byte[length];
			for (i = 0;i<length;i++){
				newBuffer[i] = buffer[i];
			}
			//returnBytes.remove(returnBytes.size()-1);
			returnBytes.add(newBuffer);
		}
		returnBytes.add(gDoc.get(gDoc.size()-1));
		return returnBytes;
	}