Confusion between system/xbin/which and system/xbin in android Hi I am trying for root check of android device I am using following code to check whether the device is rooted or not but bit confused, 

public static enum SHELL_CMD {
check_su_binary(new String[] { "/system/xbin/which", "su" });

String[] command;

SHELL_CMD(String[] command) {
    this.command = command;
}}


For checking binary SU in this code when I run the code with "/system/xbin/which" code shows me device is rooted(command run successfully), but if I remove "which"(i.e. "/system/xbin/") and run the code it throws me an exception that access denied.

Is there any specific significance of "/which" in rooting android device. 
I am running this code in CyanogenMod 11S(One Plus device) Thank you In advance
/system/xbin/which is the path of a program this script needs to execute (run). /system/xbin/ is a directory, so obviously you can't execute it.

If you've never used the which command on your desktop GNU/Linux system, you might be interested to read its manpage. In this case, the script is using it to find out if the su command exists, and the actual program it will run.