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

 

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

Write a method that returns a boolean array that represents the binary representation of 'num'. As a precondition you may assume that 0<=num<=255. The boolean array will have exactly 8 elements. The element in the 0th position is the 128's place in the binary number and the element in the 7th position is the 1's place in the binary number. Each element corresponds to the appropriate place value in the binary number. Look at the test data for examples.


test2023_11_16_P1SLHL_toBinary(21) → [false, false, false, true, false, true, false, true]
test2023_11_16_P1SLHL_toBinary(20) → [false, false, false, true, false, true, false, false]
test2023_11_16_P1SLHL_toBinary(42) → [false, false, true, false, true, false, true, false]

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

public boolean[] test2023_11_16_P1SLHL_toBinary(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: 260

Copyright Nick Parlante 2017 - privacy