HTML

2 Ways to Add Binary Numbers in Java - Coding

In the last article, I have shown you how to subtract binary numbers in Java and today, you will learn the opposite i.e. how to add binary numbers in Java. You can do binary addition in Java either by writing your own logic or by taking advantage of the Java API, which allows you to convert a binary String into a binary number. Though, if you want you can also use the logic I have shared in my earlier post about how to check binary numbers to verify input before converting it to a binary number. In this article, we'll take a look at both methods of adding two binary numbers in Java.

How to Rotate an Array to Left and Right by Given Number in Java?

Hello guys, welcome to this post with another array based coding problem. In the last article, we've learned about finding missing numbers in the array with duplicates and today we'll solve the problem of rotating an array by left or right by given number. For example, suppose an integer array {1, 2, 3} is given and it was asked to rate this array to the left by 3 then the result array will look like {2, 3, 1} because it was rotated twice on left. Similarly if asked to rotate the same array twice by right then we'll get {1, 2, 3}, the same array is back. This is an interesting problem and it's quite easy to solve but I have many programmers struggles with this one as well. So, a little bit of practice and learning will not hurt.

Difference between @SpringBootApplication vs @EnableAutoConfiguration annotations in Spring Boot

Even though both @SpringBootApplication and @EnableAutoConfiguration can be used to enable the auto-configuration feature of Spring Boot there is a subtle difference between them. The @SpringBootApplication does much more than what @EnableAutoConfiguration do. It's actually a combination of three annotations: @Configuration which is used in Java-based configuration on Spring framework, @ComponentScan to enable component scanning of components you write e.g. @Controller classes, and @EnableAutoConfgiuration itself, which is used to enable auto-configuration in Spring Boot application. Spring Boot designers realize that these three annotations are frequently used together so they bundled them into @SpringBootApplicaiton. Now, instead of three annotations you just need to specify one annotation on your Main class.