simplified energy balance:
Q,absorbed + Q,lost = 0
where Q = mc(T2-T1)
in which Q=heat in J, m=mass in kg, c=specific heat capacity (which has a definite value for various substances) in J/(kg*C), T=temperature in Kelvin
*T2=final temp (the same for both and is usually the unknown)
*T1=initial temp