In Android, I am saving the byte array to file in internal storage so the file could be .png or .txt or .pdf. How I can get extension while saving?

I have checked many solutions everywhere.They show extracting mime type which I don't want. I only want the .extension(i.e .pdf or .png or .txt) of byte array content

This is my code I have hardcoded the .pdf which i don't want

```java
try {
    // todo change the file location/name according to your needs
    time.setToNow();
    fileName = "File name" + request.getAccountNumber() + "_from" + time.format("%k : %M : %S") + ".pdf";
    //File futureStudioIconFile = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS), fileName);
    java.io.File futureStudioIconFile = new java.io.File(Environment
            .getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS)
            + "/" + fileName);
    InputStream inputStream = null;
    OutputStream outputStream = null;

try {
    byte[] fileReader = new byte[4096];

    long fileSize = body.contentLength();
    long fileSizeDownloaded = 0;

    inputStream = body.byteStream();
    outputStream = new FileOutputStream(futureStudioIconFile);    

```