Code example for DataOutputStream

Methods: flushwriteBytes

			Log.d(TAG, "Root-Command ==> su -c \""+command+"\"");
			Process p = rt.exec("su -c sh");
			//kanged from 
			DataOutputStream os = new DataOutputStream(p.getOutputStream());
			os.writeBytes(command + "\n"); os.flush();
			// and finally close the shell 
			os.writeBytes("exit\n"); os.flush();
			//end kangage 
			returncode = p.waitFor();
			if (returncode == 0) {
				return true; 
				Log.d(TAG, "root command: " + command + " failed with returncode "+ returncode);
				return false; 
		}catch(Exception e){
			Log.d(TAG, "Root-Command error, return code: " + returncode, e);
Connect your IDE to all the code out there  Get Codota for Java