Q&A

Q1:A C program that I use creates a file of integers and other data. Can I read this using a Java program?
A1: You can, but one thing you have to consider is whether your C program represents integers in the same manner that a Java program represents them. As you might recall, all data can be represented as an individual byte or a series of bytes. An integer is represented in Java using four bytes that are arranged in what is called big-endian order. You can determine the integer value by combining the bytes from left-to-right. A C program implemented on an Intel PC is likely to represent integers in little-endian order, which means the bytes must be arranged from right-to-left to determine the result. You might have to learn about advanced ...

Get Sams Teach Yourself Java 2 in 21 Days, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.