DesiredCapabilities is a class in org.openqa.selenium.remote.DesiredCapabilities package used for setting the properties of a browser such as BrowserName, Platform, Version of Browser, etc. A typical usecase would be to set the path of FirefoxDriver for testing. DesiredCapabilities class is also used when we need to use Selenium Grid for executing mutiple TestCases on multiple Systems with diff browsers, and diff versions and diff OSs.
// To Create a new object of DesiredCapabilities class.
DesiredCapabilities capabilities = new DesiredCapabilities();
// To set the android deviceName desiredcapability.
capabilities.setCapability("deviceName", "your Device Name");
// To set the BROWSER_NAME desiredcapability.
// To set the android VERSION desiredcapability.
// To set the android platformName desired capability.