Connect your android mobile to your computer using USB cable.
Then type below command in the terminal
adb devices -l
It will display all the connected device to your comaputer with device IDs.
And you can pass the device ID to your code using DesiredCapabilities
eg: if your device id is f23a5A83,
DesiredCapabilities Androidcapability=new DesiredCapabilities();
Androidcapability.setCapability("udid", "f23a5A83");