Appium - Start Appium Server Programmatically in Appium

import com.github.genium_framework.appium.support.server.AppiumServer;
import com.github.genium_framework.server.ServerArguments;

public static void setUpAppium() throws InterruptedException
    {
        ServerArguments serverArguments = new ServerArguments();
        serverArguments.setArgument("--address", "127.0.0.1");
        serverArguments.setArgument("--chromedriver-port", 9516);
        serverArguments.setArgument("--bootstrap-port", 4725);
        serverArguments.setArgument("--no-reset", true);
        serverArguments.setArgument("--local-timezone", false);

        _appiumServer = new AppiumServer(new File("<Path where Appium is installed>"), serverArguments); //D:/Program Files (x86)/Appium
    }
    
    public static void startAppiumServer() throws InterruptedException
    {
        setUpAppium();
        boolean serverStarted = _appiumServer.isServerRunning();
        _appiumServer.startServer();
        while(serverStarted == false)
        {
            serverStarted = _appiumServer.isServerRunning();
            System.out.println(serverStarted);
        }
    }