N.J. sheriff's officer resigns to avoid jail time