The service account generated according to the Java API GA4 quickstart guide lacks the necessary authentication scopes to grant access to the associated GA4 Account and Property, as indicated in the Service Account .json file.
As a result, utilizing the API to fetch analytics metrics in Java becomes unfeasible.