Determine if the device status can be used
@Test
public void devices () throws Exception
{
Person p = new person ();
list<string> deviceslist = p.excmd ("adb devices"); Executes the ADB devices command and stores the list in the collection
list<string> devlist = new arraylist<string> (); The result of defining a list collection to store the judgment, there may be multiple
if (Deviceslist.size () > 2) {
for (int i = 1;i < Deviceslist.size ()-1; i++) {
String len[] = Deviceslist.get (i). Split ("\ t"); Split () Split function
if (Len[1].trim (). Equals ("Device")) {
Devlist.add (Len[0].trim ()); Trim () Remove the trailing and trailing spaces of the string into the list collection
}
}
}
Else
{
System.out.println ("No matching device");
}
for (String s:devlist)//Output list collection contents through the Foreach function
{
SYSTEM.OUT.PRINTLN ("Device number:" +s);
}
}
@Test
public void Tirmefunt ()
{
String s = "good good";
String w = "Good good";
SYSTEM.OUT.PRINTLN ("Determine if s and W are equal" +w.equals (s));
s = S.trim ();
System.out.println ("Remove the left and right spaces in the judgment is equal: =============");
SYSTEM.OUT.PRINTLN ("Determine if s and W are equal" +w.equals (s));
String B = "111,333,4444,555,2555,66666,4444433,44223,3666";
String[] A = B.split (",");
String p = null;
for (String i:a)
{
SYSTEM.OUT.PRINTLN ("Output is:" +i);
}
System.out.println ("Merge Results" +p);
}
Java Boot DOS command collection notes two