Multi-digit array to transfer one-dimensional array conversion

xiaoxiao2021-03-05  23

STR1 is a multi-dimensional number of respective dimensional lengths

STR2 is the subscript in the elastology in the multidimensional array

Public int GET1D (String Str1, String STR2)

{

INT D1 = 0;

INT LENSTR1 = str1.length ();

String DSTR1 [] = new string [lenstr1];

String DSTR2 [] = new string [lenstr1];

For (int i = 0; i

{

DSTR1 [I] = Character.Tostring (Str1.Charat (i));

DSTR2 [I] = character.tostring (str2.charat (i));

}

For (int i = 0; i

{

INT DQ = 1;

For (int m = i 1; m

{

DQ = Integer.Parseint (DSTR1 [M]) * DQ;

}

D1 = (Integer.Parseint (DSTR2 [I]) * DQ) ​​ D1;

}

D1 = D1 Integer.Parseint (DSTR2 [LENSTR1-1]);

Return D1;

}

转载请注明原文地址:https://www.9cbs.com/read-39405.html

New Post(0)