Q:

How do I avoid repetitiveness?

Im doing a tutorial in Java and I always read that I must try not to be repetitive and I noticed this is very repetitive; So if anyone can give me some tips to make it less repetitive or somehow better it is much appriciated. Thanks ;) (This isn't part of the the tutorial, I made it just for fun because of what I am learning in science at school)

Run.java file: 
package scientificFormula;

public class Run {

    public static void main(String[] args) {
        Formula formula = new Formula();

        formula.compound1 = args[0];
        formula.compound2 = args[1];

        String theFormula = formula.createFormula();
        System.out.println("Molecule: " + args[0] + " " + args[1] + " = "
                + theFormula);
    }

}

Formula.java file:
package scientificFormula;

import java.util.HashMap;
import java.util.Map;

public class Formula {
    String compound1;
    String compound2;
    static private Map<String, String> map = new HashMap<String, String>();

    static private void initiateIons() {
        // 1+
        map.put("Hydrogen", "H^1+");
        map.put("Lithium", "Li^1+");
        map.put("Sodium", "Na^1+");
        map.put("Potassium", "K^1+");
        map.put("Rubidium", "Rb^1+");
        // 2+
        map.put("Magnesium", "Mg^2+");
        map.put("Calcium", "Ca^2+");
        map.put("Strontium", "Sr^2+");
        // 3+
        map.put("Aluminium", "Al^3+");
        // 3-
        map.put("Nitrogem", "N^-3");
        map.put("Phosphorus", "P^-3");
        // 2-
        map.put("Oxygen", "O^-2");
        map.put("Sulfur", "S^-2");
        map.put("Selenium", "Se^-2");
        // 1-
        map.put("Fluorine", "F^-1");
        map.put("Chlorine", "Cl^-1");
        map.put("Bromine", "Br^-1");
        map.put("Iodine", "I^-1");
    }

    String createFormula() {
        initiateIons();

        // Example1: Input = Calcium Iodine:
        // 2x + -1y = 0
        // x = 1 and y = 2
        // Output = CaI2
        //
        // Example2: Input = Sulfur Iodine
        // Output = Molecule: Sulfur Iodine = SI2

        String symbol1 = map.get(compound1);
        String symbol2 = map.get(compound2);

        int charge1 = Integer.parseInt(symbol1.replace("+", "").substring(
                symbol1.length() - 2));
        int charge2 = Integer.parseInt(symbol2.replace("+", "").substring(
                symbol2.length() - 2));

        String letter1 = null;
        String letter2 = null;

        if (symbol1.length() == 5) {
            letter1 = symbol1.substring(0, 2);
        } else if (symbol1.length() == 4) {
            letter1 = symbol1.substring(0, 1);
        }
        if (symbol2.length() == 5) {
            letter2 = symbol2.substring(0, 2);
        } else if (symbol2.length() == 4) {
            letter2 = symbol2.substring(0, 1);
        }

        int possitive1 = (int) Math.sqrt(charge1 * charge1);
        int possitive2 = (int) Math.sqrt(charge2 * charge2);

        if ((possitive1 == 1) & (possitive2 == 1)) {
            return letter1 + letter2;
        } else if (possitive1 == 1) {
            return letter1 + possitive2 + letter2;
        } else if (possitive2 == 1) {
            return letter1 + letter2 + possitive1;
        }
        if (possitive1 == 0) {
            possitive1 = -(charge1);
        }

        if (possitive2 == 0) {
            possitive2 = -(charge2);
        }

        return letter1 + possitive2 + letter2 + possitive1;
    }
}

A:

I highly recommend reading the book clean code which mainly deals with refactoring.
Duplicating code is just one (important) issue when you start refactoring (also called DRY - Don't Repeat Yourself). There are many other principles and I'll try describe a few of them which I find most important:
One important "rule of thumb" is the SRP: Single Responsibility Principle, which says that each class should have only one responsibility, and if we apply the same idea to methods - each method should do only one thing! It might sound very strict, but when you'll start applying it - your code will become clearer to read and easier to maintain.
Another one is using meaningful names (classes/methods/variables):
return letter1 + possitive2 + letter2; // you probably meant positive with one 's' (typo!)

might mean something to you - but it will not mean much to another reader - now, of course you can solve it by adding code comments, but that's patching the problem instead of solving it. Further, code comments get stale - either become irrelevant or even worse - might mislead the reader when the code changes and the comment doesn't.
And last (for now), keep clear order of execution, let's take a piece of code that you posted and improve it:
    String symbol1 = map.get(compound1);
    String symbol2 = map.get(compound2);

    int charge1 = Integer.parseInt(symbol1.replace("+", "").substring(
            symbol1.length() - 2));
    int charge2 = Integer.parseInt(symbol2.replace("+", "").substring(
            symbol2.length() - 2));

    String letter1 = null;
    String letter2 = null;

    if (symbol1.length() == 5) {
        letter1 = symbol1.substring(0, 2);
    } else if (symbol1.length() == 4) {
        letter1 = symbol1.substring(0, 1);
    }
    if (symbol2.length() == 5) {
        letter2 = symbol2.substring(0, 2);
    } else if (symbol2.length() == 4) {
        letter2 = symbol2.substring(0, 1);
    }

    int possitive1 = (int) Math.sqrt(charge1 * charge1);
    int possitive2 = (int) Math.sqrt(charge2 * charge2);

As we can see: positive depends on charge which depends on symbol which depends on compound. And totaly unrelated to it: letter depends on symbol which depends on compound.
let's split it to separate methods:
int getPositive(String compound) { // I have no idea what "positive", "symbol" and compound represent, consider better names please
    String symbol = map.get(compound);
    int charge = Integer.parseInt(symbol.replace("+", "").substring(
                symbol.length() - 2));
    return (int) Math.sqrt(charge2 * charge2);
}

And now we can apply the same to getLetter(String compound) {...} etc.

