I am making a subroutine that will convert a 8-bit binary number into a int value. I want it to take as a parameter a int array with a length of 8 (to represent the binary number) and reject arrays of any other length. Is the possible?
-
1No. You can check the length in your method.Flown– Flown2017-06-16 10:06:15 +00:00Commented Jun 16, 2017 at 10:06
-
You can check for the length of the given array at the start of the method and throw an exception / return null.influjensbahr– influjensbahr2017-06-16 10:06:34 +00:00Commented Jun 16, 2017 at 10:06
Add a comment
|