String to Int conversion in JAVA?
918056
There is probably a better way, or at least a more streamline way, of doing this, but off the top of my head here is what I would do:\n\n1. Create a loop to run through all the characters in your string.\n2. Test each character to see if it falls between ASCII values 47 - 58 (i.e. 0-9). If it does then the character is a number.\n3. If the first test fails then you know that it isn't a number; therefore, you know that it must be a character, so now test to see if it is a character between 'a' and 'd' (i.e. ASCII 97-100).\n\nHere is some sample code (hopefully it can help):\npublic static void main(String[] args){\nString teststr = "d3";\nchar x;\n\nSystem.out.println("Test String:" + teststr);\n\nfor(int i = 0; i < teststr.length(); i++){\nx = teststr.charAt(i);\nif(x >= 47 && x <= 58){\n// Store it however\nSystem.out.println(Integer.parseInt(""+ x));\n}\nelse if(x >= 97 && x <= 100){\nif(x == 'a')\nSystem.out.println("a=" + 1);\nelse if(x == 'b')\nSystem.out.println("b=" + 2);\nelse if(x == 'c')\nSystem.out.println("c=" + 3);\nelse if(x == 'd')\nSystem.out.println("d=" + 4);\n}\n}\n}
174568
vScrollBar1->Value provides an integer, while the label1 ->Text requires a string. Cast vScrollBar1->Value to a string and hopefully that should work.
816710
Create an outer for loop that will loop from 7 down to 0, with a step of 2.\n\nCreate one inner loops.\n\nThe inner loop should take the value of i, place it in another variable and count down to 0.\nThen print out the dollar signs for each iteration of this loop.
717749
its because "int" is only a whole number, no fractions allowed. you need to change "int n = 2.05*100;" to \n"float n = 2.05*100;".
696961
It's hard to read your code, but it looks fairly correct, at least in the way it accesses the array.  I don't see a count() method, though. Also, you have = instead of == in your if() conditional. I don't think you want that.
492653
sounds like your either entering a number that is too big or too small for a particular data type. if your using int try to switch to long and see if that works.
743647
Dim i, total As Integer\ntotal = 0\nFor i = 0 To Integer.Parse(TextBox1.Text) Step 2\n     total += i\nNext\nMsgBox(total.ToString())
1153308
import java.io.IOException;\n\npublic class PosNeg {\n\npublic static void main(String[] args) {\n\nint [] wNumbers;\nwNumbers = new int[5];\nchar c = ' ';\n\nfor (int i=0;i<5;i++) {\nSystem.out.print("Enter the #"+i+": ");\ntry {\nwNumbers[i]=System.in.read()-48;\nif (wNumbers[i]<0)\nwNumbers[i]=(System.in.read()-48)*-1;\nwhile (System.in.read()!='&#92;n'){\n}\n} catch (IOException e) {\ne.printStackTrace();\n}\nSystem.out.print("The number you entered is ");\nif (Math.abs(wNumbers[i])!=wNumbers[i])\n   System.out.println("negative.");\n else\n   System.out.println("positive.");\n}\n}\n}
103786
You could do something like:\n\n\nDim captionString As String\nDim numEntries As Integer\nDim ctr As Integer\nnumEntries = 0\n\nFor ctr = 1 to Len(txt.text)\n    If (Mid(txt.Text, ctr, 1) = "a") Then\n        If (numEntries > 0) Then\n            captionString = captionString & ","\n        End If\n        captionString = captionString & ctr\n        numEntries = numEntries + 1\n    End If\nNext ctr\nLabel1.Caption = captionString\n\nThe idea is that everything inside the For...Next loop is done at each position of the string, and so you build up the string to put in the caption of Label1.
528238
either do direct value initialization inside the bracket\n\nint MyArrayD[N]={0,0,0,0,0,0,0,0..};\n\nor \n\nfor(int i = 0; i <N; i++}\nMyArrayD[i]=0;
91787
Unfortunately, no. You'll need to parse the integer from the String entered in the text field. You can use JTextArea or JTextPane or even JPasswordField. To compare the values you'd either want to use a JButton at the bottom (for the user to click once he/she is finished entering text) and then parse an integer out of it.  View the sources below (especially the API) to view the different subclasses of the different types of text components in Swing. If you need help parsing the integer out of it, then let me know and I'll tell you how to do that (if I'm on, so don't count on it ;). Good luck!
523720
If you're asking how to convert a number (stored in binary)\ninto its decimal string, it really boils down to successive\ndivisions by 10, using the remainder as each digit (working\nfrom least significant to most).\n\nAn ugly but function version might be:\n\nchar *\nto_decimal_string(int v)\n{\n  char buff[STRSIZE];\n\n  int neg = v<0;\n  if (neg)\n    v=-v;\n\n  char *p = &buff[sizeof(buff)-1];\n  *p-- = 0;\n  if (v == 0)\n    return "0";\n  while (v>0) {\n    *p-- = "0123456789"[v%10];\n    v /= 10;\n  }\n  if (neg)\n    *p-- = '-';\n  return p+1;\n}\n\nIf you're asking how to convert an ascii string representing\na binary (base-2) number into another string representing\na decimal (base-10) number, I'd suggest using library\nroutines.  Any standard conforming C or C++ implementation\nwill provide "strtol()" and "sprintf()" (as well as other\nequivalents).\n\nThe following is purposefully done in the C subset of C++\nso that either compiler will compile it:\n\n#include <stdlib.h>\n#include <stdio.h>\n\nint\nmain(int argc, char *argv[])\n{\n  long value = strtol(argv[1], 0, 2);\n  printf("binary='%s', decimal='%d'&#92;n",\n    argv[1], value);\n  return 0;\n}\n\nThen to run it:\n\nThen to run it:\n\n$ CC convert.C\n$ a.out 10011101\nbinary='10011101', decimal='157'
769912
you loop after I if loop needs to have a concat for  -0-1-2-3-4-5-6- which you never made, you only made one for the Y columns\ni'm don't have java install so i can't check it for sorry.
565567
A code snippet would be useful here as I'm not sure what it is you are trying to do.\n\nI assume that you have to insert one string into another.  The attached snippet accomplishes this.\n\nSourceString is the string you want to insert into\nInsertSegment is the string you want to insert\nInsertPosition is the position in SourceString that you want the insertion to start at.\n\nPublic Function InsertIntoStringExample(SourceString As           String, _\n                                        InsertSegment As String, _\n                                        InsertPosition As Long) As String\n                                        \nDim ReturnString As String\n\n    If InsertPosition > 1 Then\n        If InsertPosition < Len(SourceString) Then\n            ReturnString = Mid(SourceString, \n                               1, \n                               InsertPosition - 1) & _\n                           InsertSegment & _\n                           Mid(SourceString, InsertPosition)\n        Else\n            ReturnString = InsertSegment & SourceString\n        End If\n    Else\n        ReturnString = SourceString & InsertSegment\n    End If\n    \n    InsertIntoStringExample = ReturnString\n\nEnd Function
98590
import java.util.*;\npublic class HelloWorld {   \n   public static Stack stack=new Stack(); \npublic static void main(String[] args) {\n   try {\n   String s="this is java string reverse ";\n   reverseString(s);\n   System.out.println("the reversed string value is ");\n   for(int i=stack.size()-1;i>=0;i--){\n   System.out.print(stack.get(i));\n   }\n       } \n   catch (Exception e) {\n            e.printStackTrace();\n       }\n    }\n   public static void reverseString(String s) throws Exception{\n      StringTokenizer temp=new StringTokenizer(s);\n   if(temp.hasMoreTokens()){\n   String s1=temp.nextToken();\n   stack.push(s1+" ");  \n   reverseString(s.substring(s1.length()+1));\n   }\n   else{\n   return;\n   }     \n   }  \n   \n}
150186
Dont declare @i as int, but as varchar(20) and assign it like this\n\nSET @i = '1'
552933
depends on what version of java you are using, if that doesn't work, simply do it by line:\n\nk = 1;