id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

jebbert@volusia.k12.fl.us > quiz2024_02_20_SLHL_binary
prev  |  next  |  chance

Write a method that returns an array of 32 integers. The first element in the array will always be a zero. The rest of the array will contain either 0 or 1 and will represent the binary number that represents the decimal value of 'num'. As a precondition, you may assume that 'num' is non-negative. Look at the test data for examples.


quiz2024_02_20_SLHL_binary(8712) → [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0]
quiz2024_02_20_SLHL_binary(98127) → [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 1, 1, 1, 1]
quiz2024_02_20_SLHL_binary(32) → [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0]

...Save, Compile, Run (ctrl-enter)

public int[] quiz2024_02_20_SLHL_binary(int num) { }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Difficulty: 290

Copyright Nick Parlante 2017 - privacy