This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
java.lang.StringIndexOutOfBoundsException: String index out of range: -729 at java.lang.String.substring(String.java:1503) at Proj.ReturnURL.ParsePage(ReturnURL.java:42) at Proj.ReturnURL.main(ReturnURL.java:50) Exception in thread "main" [ March 23, 2003: Message edited by: Anita Raj ]
Do you think it's very efficient to allocate an array of 1,000,000 bytes? Would it make more sense to wrap your FileInputStream with a BufferedInputStream so that you can do readLine()? And shouldn't you be using FileReader to read character data? What does your program do if it doesn't find the string it is searching for (either "a href=" or "/")? What does the indexOf return when it doesn't find a String? What effect would that have on your program? How do you ever get to the end of your while loop?