I write this code using JAVA to get data from URL, it works but I confused how to take the second data from the result in while loop,

public static void main(String[] args) throws Exception  {
 // TODO code application logic here
 URL link = new URL("");
        try (BufferedReader in = new BufferedReader(
              new InputStreamReader(link.openStream()))) {
            String inputLine;
            while ((inputLine = in.readLine()) != null)
The Resuslt :
Records:60 Counter:3,0:in,1:out,2:inside
2019/04/22 16:37:00,1797,1774,23 -------> I Just Want take This Result
2019/04/22 16:36:00,1797,1774,23
2019/04/22 16:35:00,1797,1774,23
2019/04/22 16:34:00,1797,1774,23
2019/04/22 16:33:00,1797,1774,23

1 Answers

anasmi On

Try to convert to Stream using lines() BufferReader lines, then calling skip(1) to skip the first entry and call after than findFirst Stream findFirst which returns optional of the value or empty. Something like this : line = in.lines().skip(n).findFirst().get();

Through, there are a lot of similar questions here already with answer. For example: