Java Boot DOS command collection notes two

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.