Page 1 of 1

java help

Posted: Mon Apr 24, 2006 3:56 pm
by shiznatix
I have a file with links and their rating. I want to sort the stuff by the stuff by the rating. Here is the code I have:

Code: Select all

String tmpline;
        String tmplinetwo;
        
        for (int j = 0; j < lines.length; j++)
        {            
            String [] line = tmpline.split(",");
            String [] linenext = tmplinetwo.split(",");
            
            int first = Integer.parseInt(line[2]);
            int second = Integer.parseInt(linenext[2]);
            
            if (first == second)
            {
                tmpline = lines[j];
                lines[j] = lines[j+1];
                lines[j+1] = tmpline;
            }
        }
        
        
        //String line;
        for (int r = 0; r < lines.length; r++)
        {
            if (lines[r] != null)
            {
                //line = URLDecoder.decode(lines[j],"UTF-8");
                System.out.println(lines[r]+"<--<br>");	
                //list.add(lines[j]);
            }
        }
now if i remove the 1st for loop it displays everything just fine but with it there it displays nothing at all. help?[/syntax]