FileSystem has a function to give you the default filesystem without you have to look at the configs directly:

public static URI getDefaultUri(Configuration conf)