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

 

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

Write a method that returns an integer made by using the digits from elements in the array 'nums' to make a single integer. Take, for example, if nums contains {471,39,24}, the return value would be 4713924. This is not too difficult, but I think this is difficult enough that I will not put restrictions on the methods you use to solve it (excluding cheating, of course!). So, for example, you might use arrays or strings or whatever else comes to mind. You may also search the Java API by Googling "Java API" or "Java API <topic>". As preconditions, you may assume that all elements in 'nums' will be positive and that the resulting integer that is formed will be less than MAXINT.


test2022_09_12_HL_makeInt([16]) → 16
test2022_09_12_HL_makeInt([8, 6, 7, 5, 3, 0, 9]) → 8675309
test2022_09_12_HL_makeInt([25, 6, 2, 4]) → 25624

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

public int test2022_09_12_HL_makeInt(int[] nums) { }

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: 230

Copyright Nick Parlante 2017 - privacy