### Question:
NativeRiJargon2Backend implements Jargon2Backend { String[] split(String str, char delimiter, int maxTokens) { String[] tokens = new String[maxTokens]; int from = 0; int i = 0; int len = str.length(); while (from < len - 1) { if (i > tokens.length - 1) { break; } int delimIndex = str.indexOf(delimiter, from); if (delimIndex == -1) { if (from < len) { tokens[i++] = str.substring(from, len); } break; } if (delimIndex > from) { tokens[i++] = str.substring(from, delimIndex); } from = delimIndex + 1; } if (i < tokens.length) { tokens = Arrays.copyOf(tokens, i); } return tokens; }  @Override byte[] rawHash(Type type, Version version, int memoryCost, int timeCost, int lanes, int threads, int hashLength, byte[] secret, byte[] ad, byte[] salt, byte[] password, Map<String, Object> options); @Override String encodedHash(Type type, Version version, int memoryCost, int timeCost, int lanes, int threads, int hashLength, byte[] secret, byte[] ad, byte[] salt, byte[] password, Map<String, Object> options); @Override boolean verifyEncoded(String encodedHash, int threads, byte[] secret, byte[] ad, byte[] password, Map<String, Object> options); @Override boolean verifyRaw(Type type, Version version, int memoryCost, int timeCost, int lanes, int threads, byte[] rawHash, byte[] secret, byte[] ad, byte[] salt, byte[] password, Map<String, Object> options);  }### Answer:
@Test public void splitTest() { { String str = "aaa@bbb@ccc"; String[] tokens = backend.split(str, '@', 3); String[] expectedTokens = { "aaa", "bbb", "ccc" }; assertTrue(Arrays.equals(tokens, expectedTokens)); } { String str = "@aaa@bbb@ccc"; String[] tokens = backend.split(str, '@', 3); String[] expectedTokens = { "aaa", "bbb", "ccc" }; assertTrue(Arrays.equals(tokens, expectedTokens)); } { String str = "@aaa@bbb@ccc@"; String[] tokens = backend.split(str, '@', 3); String[] expectedTokens = { "aaa", "bbb", "ccc" }; assertTrue(Arrays.equals(tokens, expectedTokens)); } { String str = "@@aaa@@bbb@@ccc@@"; String[] tokens = backend.split(str, '@', 3); String[] expectedTokens = { "aaa", "bbb", "ccc" }; assertTrue(Arrays.equals(tokens, expectedTokens)); } { String str = ""; String[] tokens = backend.split(str, '@', 3); String[] expectedTokens = {}; assertTrue(Arrays.equals(tokens, expectedTokens)); } { String str = "@aaa@bbb@ccc@ddd"; String[] tokens = backend.split(str, '@', 3); String[] expectedTokens = { "aaa", "bbb", "ccc" }; assertTrue(Arrays.equals(tokens, expectedTokens)); } }