There are a few ways to regenerate your hearts. You could use a potion of healing or a splash potion of healing, you could sleep in a bed, or you could wait and regenerate health if your hunger bar is at least 16/20 full, or 8 hunger bars full in normal survival.