Samuel Finzhry Samuel Finzhry - 5 months ago 8x
Java Question

Issues With length() And Multiples Of 3

If you get the length of a String using length(), the String always being multiples of 3 (in my case: " etc.").

Each 3 characters representing a letter, with .1 indicating a capital letter.

How do you use the length to find how many sequences of three there are in the String, for each instance of said String (each time being another multiple of 3)?


Yes to Burrito's question, I am looking to find the number of 3 character blocks in each unique String.


It's pretty simple. Next time please show the working of your code.

public int findMultiplesOf3(String value)
    return (value.length()/3);


Any length of the string which is less than 3 or not divisible by 3, the return value will only be a whole number. (For Ex 22/3 = 7.333 But the return value would be 7) Since we are returning an int (integer) value in the function header.