Note that byte arrays could be saved many places, also within files or similar.
The extension of a file can be discovered by inspect the File header. This is the first bytes, usually the first tens or hundreds of bytes of the byte array and constitute the file header. Some extensions got multiple file headers. A best effort to identity byte contents of a column in a database.
Let's use Powershell to inspect a file on disk, a sample JPEG file (.jpg). Lets run the following little script:
format-hex .\Stavkyrkje_Røldal.jpg | Select-Object -First 16
The first few bytes are FF D8 FF
I have added a sample Githu repo with utility code to check well-known file types for their file extensions.
https://github.com/toreaurstadboss/FileHeaderUtil
The following screenshot shows the application in use. It found out that a byte array seems to be a PDF file by looking at the file header and file trailer. A good match was found :

