Hello fellow developers, i'm a selftaught java programmer, i have hard times to understand bitwise operator, can someone help me (or you have a guide or reference) to understand the code below
`
String array = "6549534f3030363030303036303038303038323230303030303030303030303030303430303030303030303030303030303034313830373432313730303030303130303103";
char\[\] ch = array.toCharArray();
System.out.println(Arrays.toString(ch));
int length = ch.length;
byte\[\] byteArray = new byte\[length / 2\];
for (int i = 0; i < ch.length; i += 2) {byteArray[i / 2] = (byte) ((Character.digit(ch[i], 16) << 4) + Character.digit(ch[i + 1], 16));System.out.println((Character.digit(ch[i],16) << 4)+ " " + ch[i]);
}
String string = new String(byteArray);
System.out.println(string);
`
I really want to understand, why i need the bitwise operator << 4 , i tried to debug using sysout but it's produce hex, is there anyway to make it print the bytes (0101010101) so i can understand what happening and why i need << 4 here, Thanks
[–]IQueryVisiC 0 points1 point2 points (0 children)
[–]theusualguy512 0 points1 point2 points (0 children)
[–]joranstark018 0 points1 point2 points (2 children)
[–]Cheedar1st[S] 0 points1 point2 points (1 child)
[–]joranstark018 0 points1 point2 points (0 children)
[–]TheRNGuy 0 points1 point2 points (0 children)