Note that there are some explanatory texts on larger screens.

plurals
  1. POPrinting data in a tabular form
    text
    copied!<p>I have wrote code that prints up a list of numbers that I receive from a JSON url. There are about 5 different urls used and the list is quiet long as each url contains over 100 numbers each.</p> <p>What I would like to do is print off each of the url in tabular form i.e. if there is 5 urls, there will be 5 sets of printed results, all beside each other, insted of having one massive list.</p> <p>Here is the code I have used so far;</p> <pre><code>public static void runTimestampCheck (String url) throws IOException { //String jsonString = callURL("http://localhost:8000/eem/api/v1/metrics/temperature/288"); String jsonString = callURL(url); Data data = new Gson().fromJson(jsonString, Data.class); //System.out.println(data.getRecords()); long previousTimestamp = 01; long result; for(Data dataRecord : data.getRecords()) { if(previousTimestamp &gt; 0) { //Compare previous to current, should be diff of 60000 long x = (Long)dataRecord.getTimestamp(); result = x - previousTimestamp; //System.out.println(result); if(result != 30000) { System.out.println(result); } } System.out.println(dataRecord.getTimestamp() + "\n"); previousTimestamp = dataRecord.getTimestamp(); } } </code></pre> <p>and this is called in;</p> <pre><code> CheckTimestamp.runTimestampCheck("specific url"); CheckTimestamp.runTimestampCheck("specific url"); CheckTimestamp.runTimestampCheck("specific url"); CheckTimestamp.runTimestampCheck("specific url"); CheckTimestamp.runTimestampCheck("specific url"); </code></pre> <p>As I said the result is 1 big list of numbers but I would like to have each url post results on its own line, if thats possible?</p> <p>Any help is much appreciated.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload