Count the number of distinct subarrays
Welcome to Stack Review, the first thing I see in your code is:
class result { ..your code }

Instead of result you should use Result as a classname because as specified in java_naming_conventions : Class names should be nouns, in mixed case with the first letter of each internal word capitalized.
The second thing I see in your code is:
HashSet&lt;String&gt; subs = new HashSet&lt;String&gt;();

Better to declare instead Set&lt;String&gt; subs = new HashSet&lt;String&gt;(); that guarantees more flexibility in case you want to use another implementation of theSet interface.
About performance, briefly you have a for loop where you instantiate a new StringBuilder object at every iteration like below:
for(int i = 0; i &lt; numbers.length; i++){
   StringBuilder sb = new StringBuilder();
   ...other instructions
   sb.append(numbers[j] + &quot; &quot;);
}

There is a debated alternative to this scenario corresponding to instantiate one single StringBuilder object with a fixed capacity and resetting its length at every iteration of the loop with the StringBuilder.setLength method like below:
StringBuilder sb = new StringBuilder(Arrays.toString(numbers).length());
for(int i = 0; i &lt; numbers.length; i++){
   ...other instructions
   sb.setLength(0);
}


For every testcase I set the capacity of the StringBuilder object to
the length of the String representation of the initial array like [1, 2, 3, 4] that is the maximal string length the StringBuilder will contain.
Update after @TorbenPutkonen comment : better to use StringBuilder.setLength(0) at the beginning of the loop to improve readibility of the code, so the reader has a clear vision of the state of the StringBuilder at the beginning and not at the end.