How to retrieve application id of an application in simulator using java

How to retrieve application id of an application in simulator using java?
I need this because, i want to navigate to Documents directory of deployed app in Simulator.
e.g
/Users/admin/Library/Developer/CoreSimulator/Devices/<<SIMULATOR_ID>>/data/Containers/Data/Application/78DDB029-1292-4482-992D-F5FBDEAC0DF2/Documents/mylog-2017-02-03T04:23:56.log

I need to programatically retrieve 78DDB029-1292-4482-992D-F5FBDEAC0DF2.
P.S. I am using Appium 1.5.3 + Java + TestNG.