Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Java starts the dos command to collect notes two

2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/03 Report--

Determine whether the device state is available

@ Test

Public void devices () throws Exception

{

Person p = new Person ()

List deviceslist = p.excmd ("adb devices"); / / execute the adb devices command and store it in the list collection

List devlist = new ArrayList (); / / define one list collection to store the judged results, possibly multiple

If (deviceslist.size () > 2) {

For (int I = 1 + I < deviceslist.size ()-1 + +) {

String len [] = deviceslist.get (I) .split ("\ t"); / / split () split function

If (len [1] .trim () .equals ("device")) {

Devlist.add (len [0] .trim ()); / / trim () remove the leading and trailing spaces of the string and save them in the list collection

}

}

}

Else

{

System.out.println ("No matching devices")

}

For (String s:devlist) / / output the contents of the list collection 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 ("judge whether s and w are equal" + w.equals (s))

S = s.trim ()

System.out.println ("remove the left and right spaces to determine whether they are equal: =")

System.out.println ("judge whether s and w are equal" + w.equals (s))

String b = "111, 333, 444, 555, 2555, 6666, 44443, 44223, 3666"

String [] a = b.split (",")

String p = null

For (String iVLA)

{

System.out.println ("output result is:" + I)

}

System.out.println ("merger result" + p)

}

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report