The joule (J) is used to measure