histogram w/512 bins using integers as input data

Can the the sample code histogram256 be changed to 512 bins, using integers instead of char type as input data?
Could somebody show a working code sample?

Thanks,

Marco