I already went over the responses I found for the question I have posted, but I wasn't able to figure out something. I would really appreciate it if somebody could please articulate on this a little bit:
I was trying to convert a base64 string into binary. I came across the following code, and I have the base64 string stored in a byte array. How can I convert the byte array into binary. The code I found:
import org.apache.commons.codec.binary.Base64;
import java.util.Arrays;
public class Base64Decode {
public static void main(String[] args) {
String hello = "AAADccwwCBwOAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAAB==";
byte[] decoded = Base64.decodeBase64(hello.getBytes());
System.out.println(Arrays.toString(decoded));
}
}
Output:
[0, 0, 3, 113, -52, 48, 8, 28, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0]
Is the output correct? When I looked up some documentation for base64 conversion, I noticed the equivalent of "A" is 0. How does the array have a zero in the last slot? Would it not be having the equivalent of "B". Should my array not begin with three 0s then? How can I convert this into binary (in terms of 0s' and 1s')?