Build balanced bst and print preOrder traversal

My code gives TLE for 2 cases: https://ide.codingblocks.com/s/216240

@YashJ
i just run your code it just passed all the test cases.

@YashJ
import java.util.*;
public class Main {
public static void main(String args[]) {

	Scanner s=new Scanner(System.in);
	int T=s.nextInt();
	for(int t=1; t<=T; t++) {
		
		int n=s.nextInt();
		int arr[]=new int[n];
		for(int i=0; i<n; i++) {
			arr[i]=s.nextInt();
		}
		
		myTree tree=new myTree();
		tree.form(arr);
		tree.preOrder();
	}
}

}
class myTree{

class Node{
	int val;
	Node left,right;
	Node(int v){
		val=v;
		left=null;
		right=null;
	
	}
}

Node root;

public void form(int arr[]) {
	
	root=form(arr, 0, arr.length-1);
}

private Node form(int[] arr, int lo, int hi) {
	
	if(lo>hi) {
		return null;
	}
	
	int mid=(lo+hi)/2;
	Node nn=new Node(arr[mid]);
	nn.left=form(arr, lo, mid-1);
	nn.right=form(arr, mid+1, hi);
	
	return nn;
}

public void preOrder() {
	preOrder(root);
}

private void preOrder(Node n) {
	
	if(n==null) {
		return;
	}
	System.out.print(n.val+" ");
	preOrder(n.left);
	preOrder(n.right);
}

}

Yes it’s working now but earlier it showed TLE for 2 cases.

@YashJ
Please mark your doubt as resolved in my doubt section and rate me as well.