From your java app, you can read all transactions from the .ofx file, parse the data to construct payload for required QB API( transaction entities like - Invoice, SalesReceipt, Payments etc) and finally call those APIs to insert data into QB account.
To generate OAuth tokens which you'll be using while calling APIs, you can refer the following links.
To start development using QB API, you need to create an IA apps in Intuit's appcenter. https://developer.intuit.com/docs/0025_quickbooksapi/0010_getting_started/0010_signup
From the above link you will get - apptoken, consumer key and consumer Secret. You can use the above 3 keys in IPPOAuthPlayground(PFB link) to get the access token and access secret corresponding to your QB Online account. https://appcenter.intuit.com/Playground/OAuth
To test endpoints, you can refer APIExplorer tool. https://developer.intuit.com/apiexplorer?apiname=V3QBO
Using the above tokens, you can call any REST endpoints against your QB Online account.
If you want to download transactions directly from FIs, then you might want to have a look at CAD APIs.
https://developer.intuit.com/docs/0020_customeraccountdata
Thanks