Algorithm replacing apache Hex lib, HashMaps for hex codes