Creating editor for serializable class

Im not even sure it is possible but Id like to display a custom editor for a class in my behaviour. My setup is like this:

[System.Serializable]
public class Test
{
public bool A;
public int B;
}

public class TestBehaviour : MonoBehaviour 
{
[SerializeField]
    protected Test[] array= new Test[8];
}

// window is used to inspect specific Test objects
public class TestWindow : EditorWindow
{
    Test T;
        
    public void Set(  Test T )
    {
        this.T = T;
        Repaint();
    }
    
    void OnGUI()
    {
        if( T != null )
        {   
            var editor = Editor.CreateEditor(T); // obviously can't work because T is not a UnityGame.Object
            editor.OnInspectorGUI();
        }        
    }
}

If anyone has recommendation for me, please let me know. Most probably there is better way to setup.

Why would you want to create an Editor while OnGUI?

Editor are displaying automatically on the Inspector when your object is selected.

You’re right, when I select the behaviour it displays the Test class array data fine. I can open the array and edit the items.

However when the array is large, its a bit tedious to scroll thru all of them so I wanted to create an editor window to edit individual Test items. I have a method to select individual array element by clicking on them in the viewport.