Arduino Uno - Measuring via analog input from other device

Hello,

I want to use an Arduino Uno to measure the voltage from an other device. The Arduino is powered by a own power supply and the other device has also its own power supply.

Can I just connect both ground connections, from the Arduino and the other device to get a common ground or do I have to use an other method to measure the voltage from the second device?

As long as the other device's voltage is between 0V and 5V, connecting the grounds should be enough.