Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
    public static boolean hasRoot() {
        char[] arrayOfChar = new char[1024];
        try {
            int j = new InputStreamReader(Runtime.getRuntime().exec("su -c ls").getErrorStream()).read(arrayOfChar);
            if (j == -1) {
                return true;
            }
        } catch (IOException e) {
        }
        return false;
    }
}