da object passi a string e da string a integer, nn so se funziona l'ho fatta al volo

int val=Integer.parseInt((tree.get(k)).toString());