Same idea with less parameter passing. Since there is no passing by reference, I'm using a single element int array to denote the current position at preorder array. Should be quite straightforward without considering inorder array's index.

class Solution {
public TreeNode buildTree(int[] preorder, int[] inorder) {
int[] current = {0};
TreeNode root;
Map<Integer, Integer> inMap = new HashMap<Integer, Integer>();
for(int i = 0; i < inorder.length; i++) {
inMap.put(inorder[i], i);
}
root = buildTree(preorder, inorder, current, 0, preorder.length - 1, inMap);
return root;
}
public TreeNode buildTree(int[] preorder, int[] inorder, int[] current, int low, int high, Map<Integer, Integer> inMap){
if (current[0] >= preorder.length) return null;
TreeNode root = new TreeNode(preorder[current[0]]);
if (low > high) return null;
else {
current[0] += 1;
int i = inMap.get(root.val);
root.left = buildTree(preorder, inorder, current, low, i - 1, inMap);
root.right = buildTree(preorder, inorder, current, i + 1, high, inMap);
}
return root;
}
}