Check if user has an active subscription and then let him download wallpape

Am having trouble implementing a conditional structure for the BillingClient class method queryPurchases(String y) to check if user has an active subscription and let him download an image in the wallpaper app else prevent him from doing so. Am having trouble getting a comparison target for the if method here is the code am using

 case R.id.cv_download:
                //This is where the app's business logic goes
                //create a new BillingClient class
                 final BillingClient myclient= BillingClient.newBuilder(getActivity()).build();
                 //Establish connection to google play
                 myclient.startConnection(new BillingClientStateListener() {
                     @Override
                     public void onBillingSetupFinished(BillingResult billingResult) {
                         //The building client is ready you can setup purchases here
                         switch(billingResult.getResponseCode()){
                             case OK:
                                 myclient.queryPurchases(BillingClient.SkuType.SUBS);
                                 //I need a conditional structure here that lets me check if user has active
                                   subscription

                         }

                     }

                     @Override
                     public void onBillingServiceDisconnected() {
                    //Inform user that its not working and he should try some other time
                         Toast.makeText(getActivity(),"Connection Problems, Try Again Later",Toast.LENGTH_LONG).show();
                     }
                 });
                 //Implement conditional structure to check if user has subscription and then let him download

                 anImage      = ((BitmapDrawable) ivRandom.getDrawable()).getBitmap();
                saveImageToExternalStorage(anImage);
                Toast.makeText(getActivity(), "Download successfuly", Toast.LENGTH_SHORT).show();

                break;

getting the last modified date of file in java

I am trying to get information on when was the last date a file was modified in java. I have the date in long format. I dont know why the long object is showing the year to be 1970.Below is my code


File mypath=new File(my_global_folder+"/"+mydata.getItemAtPosition(position));
 long time=mypath.lastModified();
 //When i try to convert long to Date the year part reads 1970
 Date mydate= new Date(time);


Can anyone help me modify the code to give the right lat modified date