Java: how do icheck if a certain character is within a string, then print out the position it is in relative to the string?
What I am trying to do, is create a method, that has a string and a character as parameters, the method then takes the string and searches for the given character. If the string contains that character, it returns an array of integers of where the character showed up. Here is what I have so far:

    public class Sheet {
	public static void main(String[] args) {
		String string = "bbnnbb";
		String complete = null;
		//*******
		for(int i = 0; i < string.length(); i++){
			complete = StringSearch(string,'n').toString();
		}
                //********
	}

	public static int[] StringSearch(String string, char lookfor) {
		int[]num = new int[string.length()];
		for(int i = 0; i < num.length; i++){
			if(string.charAt(i)== lookfor){
				num[i] = i;
			}
		}
		return num;
	}
}

The method works fine, and returns this:

0
0
2
3
0
0

What I am trying to do, is make those into 1 string so it would look like this "002300".
Is there any possible way of doing this? I have tried to do it in the starred area of the code, but I have had no success.

Thanks
Any help would be greatly appreciated
Java: how do icheck if a certain character is within a string, then print out the position it is in relative to the string?
===

What I am trying to do, is create a method, that has a string and a character as parameters, the method then takes the string and searches for the given character. If the string contains that character, it returns an array of integers of where the character showed up. Here is what I have so far:

    public class Sheet {
	public static void main(String[] args) {
		String string = "bbnnbb";
		String complete = null;
		//*******
		for(int i = 0; i < string.length(); i++){
			complete = StringSearch(string,'n').toString();
		}
                //********
	}

	public static int[] StringSearch(String string, char lookfor) {
		int[]num = new int[string.length()];
		for(int i = 0; i < num.length; i++){
			if(string.charAt(i)== lookfor){
				num[i] = i;
			}
		}
		return num;
	}
}

The method works fine, and returns this:

0
0
2
3
0
0

What I am trying to do, is make those into 1 string so it would look like this "002300".
Is there any possible way of doing this? I have tried to do it in the starred area of the code, but I have had no success.

Thanks
Any help would be greatly appreciated