working hex to decimal soln in rb