title: Reading first 5 lines of a URL, then printing in reverse order
body: <p>I want to write a simple program that reads the first five lines of a URL and then prints them out in reverse order, so it'd be line 5, line 4, line 3, line 2, line 1. </p>
  
  <p>Here's what I've got so far:</p>
  
  <pre><code>public static void main(String[] arg) throws Exception {
  
      BufferedReader keyboard;
      String inputLine;
  
      keyboard = new BufferedReader(new InputStreamReader(System.in));
  
      System.out.print("Please enter the name of a company (without spaces): ");
      System.out.flush();        /* Make sure the line is printed immediately. */
      inputLine = keyboard.readLine();
  
      URL u = new URL("http://www." + inputLine + ".com/");
      InputStream ins = u.openStream();
  
      InputStreamReader isr = new InputStreamReader(ins);
      BufferedReader readURL = new BufferedReader(isr);
  </code></pre>
  
  <p>What would be the most elegant way to do what I'm trying to do?</p>