Tagged articles
18 articles
Page 1 of 1
Java Tech Enthusiast
Java Tech Enthusiast
Jan 24, 2025 · Fundamentals

Sum of Two Integers Without Using + or - Operators

The problem asks to add two integers without using '+' or '-', which is solved by repeatedly applying bitwise XOR to obtain the sum without carry and left‑shifted AND to compute the carry until it vanishes, as demonstrated in concise Java and Python implementations with O(1) time and space complexity.

algorithmbitwiseno-plus-minus
0 likes · 4 min read
Sum of Two Integers Without Using + or - Operators
BirdNest Tech Talk
BirdNest Tech Talk
Sep 8, 2024 · Fundamentals

How to Define and Manipulate Bit Flags in Rust with the bitflags Crate

This guide shows how to add the bitflags crate to a Rust project, define a Permissions flag struct using the bitflags! macro, and perform common operations such as checking, inserting, and removing flags, while explaining the automatically derived traits and useful helper methods.

RustSystems ProgrammingType Safety
0 likes · 3 min read
How to Define and Manipulate Bit Flags in Rust with the bitflags Crate
macrozheng
macrozheng
Jul 19, 2024 · Backend Development

Master Java Obfuscation: 5 Crazy Tricks to Write Unreadable Code

This article reveals five advanced Java tricks—using Unicode escapes in comments, over‑complicating simple logic with bitwise shifts, tampering with Boolean.TRUE via reflection, forcing both branches of an if‑else to run, and leveraging the Unsafe class for low‑level memory manipulation—to deliberately make code hard to understand.

JavaReflectionUnicode
0 likes · 12 min read
Master Java Obfuscation: 5 Crazy Tricks to Write Unreadable Code
Liangxu Linux
Liangxu Linux
Jul 11, 2023 · Fundamentals

Unlock the Power of Bitwise Operations in C: Tips, Tricks, and Real‑World Code

This article explains the fundamentals of bitwise operations in C, covering their advantages, operator symbols, precedence, common tricks such as parity checks, power‑of‑two tests, swapping values, bit masks, and includes numerous code snippets and practical examples for efficient low‑level programming.

algorithm tricksbit manipulationbitwise
0 likes · 13 min read
Unlock the Power of Bitwise Operations in C: Tips, Tricks, and Real‑World Code
macrozheng
macrozheng
Sep 6, 2022 · Backend Development

How to Write Java Code That Even Your Colleagues Can’t Understand

Explore a series of unconventional Java tricks—from Unicode escape hacks and bitwise tricks to reflection-based Boolean tampering and Unsafe memory manipulation—that let you deliberately obfuscate code, making it hard for teammates to read, modify, or even predict its behavior.

JavaReflectionbitwise
0 likes · 14 min read
How to Write Java Code That Even Your Colleagues Can’t Understand
Java Architect Essentials
Java Architect Essentials
May 21, 2022 · Fundamentals

How to Compute an Unsigned Integer Average Without Overflow

This article explores why the naïve (a + b) / 2 formula overflows for 32‑bit unsigned integers and presents several safe techniques—including subtraction‑first, bitwise‑based, wide‑type casting, and carry‑rotate instructions—complete with C++ code and assembly examples.

AssemblyCaverage
0 likes · 11 min read
How to Compute an Unsigned Integer Average Without Overflow
Liangxu Linux
Liangxu Linux
Aug 22, 2021 · Fundamentals

Swap Variables Without a Temp: The XOR Trick Explained

This article introduces the XOR (exclusive OR) operation, explains binary representation of numbers, demonstrates how XOR can swap two integer values without a temporary variable, and provides a concise C code example illustrating the technique.

bitwisevariable swapxor
0 likes · 4 min read
Swap Variables Without a Temp: The XOR Trick Explained
Sohu Tech Products
Sohu Tech Products
Apr 1, 2020 · Fundamentals

Bitwise Operations: Techniques and Applications in Algorithmic Problems

This article introduces the basics of bitwise operations, common operators, practical tricks such as checking parity, setting or clearing bits, and demonstrates their use in solving classic algorithmic challenges like the poison bottle puzzle, power‑of‑two detection, counting set bits, and the 8‑Queens problem.

algorithmbit manipulationbitwise
0 likes · 17 min read
Bitwise Operations: Techniques and Applications in Algorithmic Problems
Java Captain
Java Captain
May 28, 2019 · Fundamentals

Five Classic Bitwise Operation Techniques in Java

This article introduces five classic bitwise operation examples in Java—including checking odd/even, swapping variables without a temporary, finding a unique number, fast exponentiation, and determining the greatest power of two not exceeding N—explaining the underlying binary logic, code implementations, and their efficiency advantages.

BinaryJavaalgorithm
0 likes · 10 min read
Five Classic Bitwise Operation Techniques in Java
Programmer DD
Programmer DD
Jan 18, 2019 · Fundamentals

Master Java Bitwise Operations: From Binary Basics to Advanced Tricks

This tutorial explains Java's signed two's complement representation, demonstrates how to output binary strings, covers all bitwise operators (AND, OR, XOR, NOT, shifts), clarifies original/one's/complement forms, shows overflow handling, unsigned tricks with masking, and teaches packing multiple boolean flags into a single byte for efficient storage.

Binarybit operationsbitwise
0 likes · 18 min read
Master Java Bitwise Operations: From Binary Basics to Advanced Tricks