How to register an android device for push notifications

Hi, I am working on an android e-commerce application. I need to send notifications based on the availability of the product to a customer. I am planning to use Firebase Cloud Messaging to achieve this. From the push notifications documentation, I see that I need to register the device or subscribe to the topic to send a notification. I could not find any proper documentation or example of how to create a push instance and register the device in android or using java. can anyone help me with resources to implement this.