I am newbie, I am trying to read data from the binary {each record written in little Endian binary format}, so the following code I found it through search! could anyone help to convert C++ into Java please...

int main()
unsigned char bytes[4];
int sum = 0;
FILE *fp=fopen("file.txt","rb");
while ( fread(bytes, 4, 1,fp) != 0) {
sum += bytes[0] | (bytes[1]<<8) | (bytes[2]<<16) | (bytes[3]<<24);
return 0;

Thanks in advance!