嗨我在分割字符串构建器和打印后尝试打印字符串构建器让我看看我的代码,
string.append("Memomry usage:total:"+totalMemory/1024/1024+
"Mb-used:"+usageMemory/1024/1024+
" Mb("+Percentage+"%)-free:"+freeMemory/1024/1024+
" Mb("+Percentagefree+"%)");
Run Code Online (Sandbox Code Playgroud)
在上面的代码中,"totalmemory"和"freememory"是双重类型,其字节值不为空,所以我将它除以"1024"两次得到"Mb","string"是字符串生成器的变量使用之后代码我只是打印它得到的结果,如下所示,
Used Memory:Memomry usage:
total:13.3125Mb-used:0.22920989990234375Mb (0.017217645063086855%)
-free:13.083290100097656Mb (0.9827823549369131%)
Run Code Online (Sandbox Code Playgroud)
我希望获得二进制位置的百分比和mb中使用和空闲内存的值,就像这个"使用:2345.25"在这个问题中记得
希望你的建议
提前致谢
我试图设计我的第二列"导师名称",因为我用css它给整个网格的风格我也试过"控制风格css类=(一些其他的CSS文件)"和"项目风格水平对齐=右",也改变property align = right在css文件中使用#,但模板字段不允许"id"实现css我的.aspx页面和下面的css ar,
.mGrid {
width: 100%;
background-color: #fff;
margin: 0px 0 0px 0;
border: 0px #525252;
}
.mGrid table
{
border:0px;
}
.mGrid td {
padding: 2px;
border-width: 0px ;
background-color:#3A3F3E;
color: #fff;
text-align:left;
}
td#Mname {
text-align:left;
}
.mGrid th {
padding: 4px 2px;
color: #fff;
background-color:#3A3F3E;
border-width: 0px ;
font-size: 0.9em;
text-align:center;
}
<asp:GridView Width="300px" ID="GridView1" runat="server" AutoGenerateColumns="False"
Font-Size="10pt" OnRowCreated="GridView1_RowCreated" CssClass="mGrid">
<Columns>
<asp:BoundField DataField="mentor_id" HeaderText="Image" />
<asp:TemplateField HeaderText="Image">
<ItemTemplate>
<asp:Image ID="Image2" runat="server" ImageUrl="~/images/small_image.png" />
</ItemTemplate> …Run Code Online (Sandbox Code Playgroud) 我试图让百分比,但我的代码是给"0.0",而这两个totalMemory和usageMemory具有值我还设置小数点后4位,也不过结果是"0.0000"我的代码,
private static long maxMemory=0;
private static long freeMemory=0;
private static long totalMemory=0;
private static long usageMemory=0;
private static double Percentage;
Runtime runtime=Runtime.getRuntime();
maxMemory=runtime.maxMemory();
freeMemory=runtime.freeMemory();
totalMemory=runtime.totalMemory();
usageMemory=totalMemory-freeMemory;
Percentage=((usageMemory/totalMemory)*100.0);
//NumberFormat percentage =NumberFormat.getPercentInstance();
//percentage = new DecimalFormat("0.0#%");
//String pr = percentage.format(Percentage);
System.out.print(Percentage);
System.out.print("Total Memory:"+totalMemory+"\n");
System.out.print("Memory Usage:"+usageMemory+"\n");
Run Code Online (Sandbox Code Playgroud)
请帮助我,我做错了,在这方面的任何帮助非常感谢.
提前致谢 !
假设我有这样的代码,
(var1==true && var2==true)
{
somemethod();
}
Run Code Online (Sandbox Code Playgroud)
假设我们有一种语言,其中我们没有&&运算符,它不是语言中的exsis然后在条件中改变使它像(var1 == true || var2 == true)并且工作就像运算符那样condion true然后它进入循环并且不使用任何代码,例如使用if条件为两个条件使其工作希望您的建议提前感谢
嗨!我正在尝试生成素数,但我的条件i%i是产生错误.
我收到错误"尝试除以零".
我该怎么解决这个问题?
int a, n, i;
Console.WriteLine("Enter ur number");
n = Convert.ToInt32(Console.ReadLine());
for (i = 0; i <= n; i++)
{
if ((i % 2 == 0) && (i % i == 0))
{
a = i;
Console.WriteLine("The prime numbers are", a);
}
}
Console.ReadLine();
Run Code Online (Sandbox Code Playgroud)
希望很快听到你的意见......