Bitwise interview question

java concepts as well as SQL concepts