Java

Server-less Java : Dec > Bin

Java as cloud-deployed AWS Lambda Functions operating through the AWS API Gateway.


Simple, interactive Java examples collected over the last 10 months or so...

Problem

Convert a decimal number to a binary value

Solve

Step 1. The Method


Progressively add the result of a mod2 operation to a StringBuilder, then reverse the StringBuilder. StringBuilder for this will have a O(n) complexity where n is the number of binary digits appended to the StringBuilder.

Implement