With this.

Code:
public static void main(String[] args) throws IOException {
  
  String s = "hello world";
  byte[] sT = {'h','i'};
  Path path = FileSystems.getDefault().getPath

("D:/Users/Kolton/Desktop/codebreaker/learn/Learnpath/Test2.txt"); 

  try 
   (RandomAccessFile rA = new RandomAccessFile(file, "rw")) {
  rA.write(sT, 1, 2);
       } 
      }
     }
I get this error

Code:
Exception in thread "main" java.lang.IndexOutOfBoundsException
        at java.io.RandomAccessFile.writeBytes(Native Method)
        at java.io.RandomAccessFile.write(RandomAccessFile.java:499)
        at Test.main(Test.java:103)
Press any key to continue . . .