Getting state and nonce on SpringBoot application

I need to create an \authorize URL from our Spring Boot application and send it to Okta .
Design given to be followed -***************&response_type=code&scope=openid profile email&redirect_uri=NewSpringBootEndpointWhereTokenWillBeSent&state=UseALibraryToCreateState&response_mode=fragment&nonce=UseALibraryToCreateNonce

Can someone please help and let me know how to get the state and nonce on Spring Boot application?

Thanks in advance for any help.