public class Main
{
public static void main(String[] args)
{
byte[] data = new byte[5];
BinaryReader file = new BinaryReader(File.Open("test.gif", FileMode.Open));
for (int i = 0; i < 5; i++)
{
data[i] = file.ReadByte();
}
file.Close();
if (data[0] == (byte)'G' && data[1] == (byte)'I' && data[2] == (byte)'F' && data[3] == (byte)'8')
{
System.out.println("Its a GIF8" + data[4]);
}
else
{
System.out.println("It not gif file");
}
}
}