我正在尝试用字符串创建一个倒金字塔。循环从每一端减去一个字符。只有它的右侧被减去。我如何让它对左侧做同样的事情?我怎样才能让它正确打印每行的长度?
int x = 0;
int space = ' ';
space = space + ' ';
int counter = fullName.length();
for( x = 0; x < fullName.length()/2; x++ )
{
System.out.println( counter - x + " [" + fullName.substring( x, fullName.length() - x ) + "]" );
}