Masses for free-floating planets and dwarf planets