Use the % operator.
long bignum = 2844493234;int smallernum = bignum % 1000000;
Where are you getting this number? Why are you only interested in the last 6 digits? What if the number is only a 3 digit number?
So by using % (modulo) it divides the number until it can't be divided any more then returns the remainder