public static byte[] B64tobyte(String ec) {

		String dc = "";
		
		int k = -1;
		while (k < (ec.length() - 1)) {

			int right = 0;
			int left = 0;
			int v = 0;
			int w = 0;
			int z = 0;

			for (int i = 0; i < 6; i++) {
				k++;
				v = B64.indexOf(ec.charAt(k));
				right |= v << (i * 6);
			}

			for (int i = 0; i < 6; i++) {
				k++;
				v = B64.indexOf(ec.charAt(k));
				left |= v << (i * 6);
			}

			for (int i = 0; i < 4; i++) {
				w = ((left & (0xFF << ((3 - i) * 8))));
				z = w >> ((3 - i) * 8);
				if(z < 0) {z = z + 256;}
				dc += (char)z;
			}
				
			for (int i = 0; i < 4; i++) { 
				w = ((right & (0xFF << ((3 - i) * 8)))); 
				z = w >> ((3 - i) * 8);
				if(z < 0) {z = z + 256;}
				dc += (char)z;
			}
		}	
		
		byte[] Result = new byte[1024];
		try {
			// Force the encoding result string
			Result = dc.getBytes("8859_1");
		} catch (UnsupportedEncodingException e) {e.printStackTrace();}		
		return Result;
	}