I have a code which I wanted to split based on the forward slash \"/\".
Whenever I have a regex split based on \"////\" it never splits and gives me the whole string
There is no need to escape forward slashes. Your code works fine if you just do:
String[] paths = path.split("/");