convert NSData into integer,
please test the correctness