Clustering of Galaxies in a Hierarchical Universe: I. Methods and Results at z=0