P
Pasquale Imbemba
Hello,
in my little programm:
public class Shift1 {
public static void main (String [] args) {
int thirteen = 13;
int ten;
ten = thirteen << 1;
System.out.println ( thirteen + " is now " + ten);
}
}
I expect 13 (1101) to be shifted by one position to the left, i.e.
becoming 101. I expected Java to fill the righthand of the bit sequence
with a 0, thus 1010, which should return me 10. It returns 6 instead.
What I wrong here?
Bye
Pasquale
in my little programm:
public class Shift1 {
public static void main (String [] args) {
int thirteen = 13;
int ten;
ten = thirteen << 1;
System.out.println ( thirteen + " is now " + ten);
}
}
I expect 13 (1101) to be shifted by one position to the left, i.e.
becoming 101. I expected Java to fill the righthand of the bit sequence
with a 0, thus 1010, which should return me 10. It returns 6 instead.
What I wrong here?
Bye
Pasquale