It seems to work, but I'm not positive, as I'm limited (to an AVD) in my ability to test it. I came up with this algorithm to check if I'm rooted. Think it will always work? I'm not convinced.
private boolean isRooted() {
try {
Process process = new ProcessBuilder()
.command("/system/bin/su")
.redirectErrorStream(false)
.start();
} catch (IOException e) {
return false;
}
return true;
}