Getting NZEC in PT07Z(longest path in a tree) when answer is right? Any bad coding practice?

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayDeque;
import java.util.HashSet;
import java.util.Queue;

class PT07Z2
{ static int pop;
static boolean marked[];

static int dist;

public static void main(String args[])
{ try {
int a,b,n;
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int node=n=Integer.parseInt(br.readLine());
HashSet[] hs=new HashSet[node];
for(int i = 0; i < node; i++){
hs[i] = new HashSet<>();
}
marked= new boolean[node];
Queue popper= new ArrayDeque<>();
while(node>1)
{
String str[]=br.readLine().split(" ");
a=Integer.parseInt(str[0]);
b=Integer.parseInt(str[1]);
hs[a-1].add(b-1);
hs[b-1].add(a-1);
node–;
}
popper.add(0);
int present_level=1;
int next_level=0;
int from= bfs(popper, hs,present_level,next_level);
popper.add(from);
marked= new boolean[n];
dist=0;
present_level=1;
next_level=0;
bfs(popper, hs,present_level,next_level);
System.out.println(dist-1);
} catch (Exception e) {
System.out.println(e);

}

}
static int bfs(Queue popper, HashSet[] l,int pl,int nl)
{
pop=popper.remove();
pl–;

marked[pop]=true;
for(int i:l[pop])
if(marked[i]==false)
{

    popper.add(i);
    nl++;


}

if(pl==0)
{pl=nl;

nl=0;
dist++;
}

if(!popper.isEmpty())
bfs(popper, l,pl,nl);

return pop;
}
}

sorry a more easy on the eye version here : http://ideone.com/LWSsEj