java help

XML, Perl, Python, and other languages can be discussed here, even if it isn't PHP (We might forgive you).

Moderator: General Moderators

Post Reply
User avatar
shiznatix
DevNet Master
Posts: 2745
Joined: Tue Dec 28, 2004 5:57 pm
Location: Tallinn, Estonia
Contact:

java help

Post 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]
Post Reply