also...

what is the oxidation number of H in MgH2?
--->i know H can have - or + 1 oxidation number and Mg can have +2. how can you tell which has to be negative and positive?