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

 

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

Write a method that converts an array of binary digits into the equivalent integer value. However, it is possible that there is an error in the array. An error is any digit other than 1 or 0. In the event of an error, return -1. If there is no error, return the integer value that matches the binary number represented by the array.


sunFunBinary([1]) → 1
sunFunBinary([1, 1, 1]) → 7
sunFunBinary([0, 0, 1]) → 1

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

public int sunFunBinary(int[] bits) { }

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