public int countOccurrences(int target){
    IntBTNode cursor = root;
    int count = 0; 
    int nextElement;
    if(root == null){
        return 0;     
    }
    while(cursor != null){
        if(target < cursor.getData())
        {
        	nextElement = cursor.getLeft().getData();
        	System.out.println("next data = " +nextElement);
            cursor = cursor.getLeft();
            
            
        }else if(target > cursor.getData())
        {
            cursor = cursor.getRight();
        }else
        {//means target and cursor.data are equal 
            count++;
            
            System.out.println("find!!" + counter + "\ncount = " + count);
            //System.out.println("next value right" + cursor.getRight().getData());
            //System.out.println("next value left" + cursor.getLeft().getData()); 
            //cursor = cursor.getLeft();  
            cursor = cursor.getRight();
            
      }
    }
    return count;
 }