  We develop a new method to constrain the star formation histories, dust
attenuation and stellar masses of galaxies. It is based on two stellar
absorption line indices, the 4000 Angstrom break strength and the Balmer
absorption line index Hdelta_A. Together, these indices allow us to constrain
the mean stellar ages of galaxies and the fractional stellar mass formed in
bursts over the past few Gyr. A comparison with broad band photometry then
yields estimates of dust attenuation and of stellar mass. We generate a large
library of Monte Carlo realizations of different star formation histories,
including starbursts of varying strength and a range of metallicities. We use
this library to generate median likelihood estimates of burst mass fractions,
dust attenuation strengths, stellar masses and stellar mass-to-light ratios for
a sample of 122,208 galaxies drawn from the Sloan Digital Sky Survey. The
typical 95% confidence range in our estimated stellar masses is +-40%. We study
how the stellar mass-to-light ratios of galaxies vary as a function of absolute
magnitude, concentration index and photometric pass-band and how dust
attenuation varies as a function of absolute magnitude and 4000 Angstrom break
strength. We also calculate how the total stellar mass of the present Universe
is distributed over galaxies as a function of their mass, size, concentration,
colour, burst mass fraction and surface mass density. We find that most of the
stellar mass in the local Universe resides in galaxies that have stellar masses
\~5\times 10^10 M_sol, half light radii ~3 kpc, and half- light surface mass
densities ~10^9 M_sol/kpc^2. The distribution of D(4000) is strongly bimodal,
showing a clear division between galaxies dominated by old stellar populations
and galaxies with more recent star formation.
