Given that the command is supposed to be only the 3 msb (most significant bits) yes...
You probably want to AND with 0xE000 instead of ... 0xF000
However! ... since you are looking only for the three most significant bits, there's no need to strip lower bits with AND at all... You can just send them to the bit-bucket.
Code:
command = number >> 13:
will get the job done.
Something you will find very handy when bit twiddling is to take a second and write down the binary values for 0 to F ... then you have a visual reference that can show you what values you need.