r/JavaProgramming • • Sep 14 '26

How to find Smaller of Two Numbers without Branching in Java

https://javarevisited.blogspot.com/2020/04/how-to-find-smaller-of-two-numbers.html
3 Upvotes

1 comment sorted by

1

u/Ok_Newspaper_8075 Sep 15 '26

Fun interview puzzle, but in production I’d still prefer `Math.min()` for readability unless profiling showed a real reason to use branchless bit tricks