parse int by hand