Stored Credential from Google API to be reused using Java

public Credential buildEmptyCredential() {
    Credential credential = null;
    try {
        credential = new GoogleCredential.Builder()
            .setClientSecrets(Utils.getClientCredential())
            .setTransport(new NetHttpTransport())
            .setJsonFactory(Constant.JSON_FACTORY)
            .build();
    } catch (IOException e) {
        e.printStackTrace();
    }

    return credential;
}

buildEmptyCredential()
    .setRefreshToken(storedCredential.getRefreshToken())
    .setAccessToken(storedCredential.getAccessToken())
    .setExpirationTimeMilliseconds(storedCredential.getExpirationTimeMilliseconds());

You can create GoogleCredential object from stored credentials like this:

GoogleCredential credential = new GoogleCredential.Builder()
        .setTransport(new NetHttpTransport())
        .setJsonFactory(new JacksonFactory())
        .setClientSecrets("client_id", "client_secret")
        .build();

credential.setAccessToken("access_token");