Skip to content
Advertisement

Tag: integer

Returning an int array in Java

So I need a script that returns an array of a text document. The document is all numbers. Everytime I try to run it I get this message “This method must return a result of type int[]” this is under the checker part. I am trying to return it to another class so that I can use the array for

simple java program returning incorrect value

Hello I am brushing up on Java practice. I have this very simple program: There are two int values, along with a boolean variable. i) The program will return true if one of these values is negative and one is positive. ii) However, if the boolean variable is true, the program can only return true if both int values are

Integer.parseInt() and Integer.toString() runtime

Would the runtime of Integer.parseInt(String i) and Integer.toString(int i) both be O(n)? Answer Yes both of them Integer.parseInt(“1000”) and Integer.toString(1000) have time complexity O(N) The internal code of Integer.parseInt(“1000”) reads the the strings char by char and covert to decimal in while loop The internal code of Integer.toString(1000) reads the integers and convert every digit to char and stores in

Advertisement