Shift the bits left, shift the bits right, mask, read, set, test |
|
Week of December 6, 2021 |
|
|
|
|
When it comes to raw bit manipulation, many developers instinctively reach for C. However, thanks to classes such as java.math.BigInteger and java.util.BitSet, you can extract, clear, set, shift, and mask bits with ease in Java. Eric Bruno runs through the basics of bit manipulation using those two classes, and then he takes everyone on a journey through interfacing with a common automobile-area network, the CAN bus.
As Eric explains, given that the JVM is available for multiple CPU architectures and operating systems, Java can be a superior choice over C, which would otherwise require you to build a tool chain and rely on cross-compilers for embedded projects.
Take care, Alan Zeichick Editor in Chief, Java Magazine @zeichick
P.S. Did you know that database expert Chris Saxon offers regular quizzes on SQL and PL/SQL for the Oracle Dev Gym? To date, he’s written more than 750 quizzes. Read about how Chris became a quiz writer, and then check out his latest quizzes for Oracle Database 21c here. |
|
The newest articles |
Binary bit manipulation and CAN bus hardware interfaces in Java When you need to interface with hardware devices at a low level, you often need to read and manipulate individual bits from software. While most programmers don’t think of using Java for this, it’s not only possible but, as you’ll see, it’s very straightforward. Eric Bruno explains.
Modern file input/output with Java: Let’s get practical Learn from Ben Evans how the Path API handles file system–specific extensions, including how to access features such as file attributes and symbolic links. He also shows you how to traverse a directory structure, how to watch for changes to files or directories, and how to create and dispose of temporary files.
Arm resources show how to optimize your Java applications for AArch64 Java developers don’t need to worry about the deployment hardware as long as a first-class JVM is available, and that’s certainly the case for Arm processors. Whether you’re writing the code or running the code, it’s business as usual: At the end of the day, it’s plain old Java bytecode. But what if you want to know more? Here’s a selection of resources from Arm. |
|
Complimentary subscription to Java Magazine |
Java Magazine is a deep dive into Java and the JVM. Find detailed explanations about the language and the platform written by experts and members of the Java development team.
Join a quarter of a million subscribers in getting useful, authoritative programming information delivered directly to your inbox. |
|
|
|
|