let x be the length of the shorter side. legs are x and x+8, hypotenuse it's x+16
x²+(x+8)² = (x+16)²
x²+x²+16x+64=x²+32x+256
2x²+16x+64=x²+32x+256
x²-16x-192=0
(x-24)(x+8)=0
x= 24 or -8. since length cannot be negative, 24 is the short side, 32 is the long side, and 40 is the hypotenuse