An exact information spectrum-type formula for the maximum size of finite length block codes subject to a minimum pairwise distance constraint is presented. This formula can be applied to codes for a broad class of distance measures, which only requires having the minimum value between a point and itself. As revealed by the formula, the largest code size is fully characterized by the information spectrum of the distance between two independent and identically distributed (i.i.d.) random codewords drawn from an optimal distribution. Under an arbitrary uniformly bounded distance measure, the asymptotic largest code rate (in the block length n) attainable for a sequence of (n, M, nδ)-codes is given exactly by the maximum large deviation rate function of the normalized distance between two i.i.d. random codewords.