If you know Host name, channel name and port number, then you can get the queue manager name like below:
MQEnvironment.channel = 'SYSTEM.DEF.SVRCONN'; //Replace with your channel name
MQEnvironment.hostname = 'localhost'; //Replace with your host name
MQEnvironment.port = 1414; //Replace with your port number
MQQueueManager QM_OBJ= new MQQueueManager("");
String QueueManagerName = QM_OBJ.getAttributeString(MQC.MQCA_Q_MGR_NAME, 100).trim();