Automating Cmd+Shift+H (home Key) button press in iOS using appim with Java

I’ve launched the app I want on the iOS (iPhone 6) simulator. Now I want to be able to press the home button (on the simulator) and navigate to other apps. How do I do that in Java?

public void pressHomeButton() {
	String simulatorAppName = "Simulator";
	try {

		String[] args = { "osascript", "-e", "tell application \"System Events\" \n tell application \""
				+ simulatorAppName
				+ "\" to activate \n tell application \"System Events\" to keystroke \"h\" using {command down, shift down} \n end tell" };
		Process process = Runtime.getRuntime().exec(args);
		BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(process.getErrorStream()));
		String lsString;
		while ((lsString = bufferedReader.readLine()) != null) {

		try {
		} catch (Exception e1) {
	} catch (Exception e) {

Although its stale post, just thought to add a snippet here to help other folks on Mobile automation forum.

Please see my answer for “launching the home screen in is simulator” here