Click here to Skip to main content
15,889,027 members
Home / Discussions / Java
   

Java

 
QuestionWhat is the good use-case example for Java generics besides collection framework? Pin
ygnusin23-May-16 2:59
ygnusin23-May-16 2:59 
AnswerRe: What is the good use-case example for Java generics besides collection framework? Pin
Richard MacCutchan23-May-16 3:35
mveRichard MacCutchan23-May-16 3:35 
QuestionMapped drives not included in File.listRoots() Pin
hansoctantan18-May-16 23:41
professionalhansoctantan18-May-16 23:41 
Questionproject request Pin
Salma Yossef18-May-16 11:39
Salma Yossef18-May-16 11:39 
AnswerRe: project request Pin
Richard MacCutchan18-May-16 21:07
mveRichard MacCutchan18-May-16 21:07 
Questionintegrated a bootstrap with spring mvc3 Pin
Member 1253127718-May-16 7:46
Member 1253127718-May-16 7:46 
AnswerRe: integrated a bootstrap with spring mvc3 Pin
Richard MacCutchan18-May-16 21:07
mveRichard MacCutchan18-May-16 21:07 
QuestionProduce repmat() method using java Pin
Member 1207967715-May-16 8:42
Member 1207967715-May-16 8:42 
C#
arr = [6,3,9,0];

repmat(arr,2,1,2) method in matlab produce a format which is :

L(:,:,1) =

6 3 9 0
6 3 9 0


L(:,:,2) =

6 3 9 0
6 3 9 0

****************************************************************
C#
the java code is :

  i<pre lang="java">mport java.util.*;
   class test23{
   public static void main ( String [] args ) {
    int[] arr = {6,3,9,0};
    test23 test = new test23();
   System.out.println(Arrays.deepToString(test.repmat(arr,3,1)));
    }
 
 public static int[][] repmat (int[] array, int rows, int columns)
  {
    int arrayLength = array.length;
    int resultColumns = arrayLength * columns;
 
    int[][] result = new int[rows][resultColumns];
 
    int z = 0;
 
    for (int r = 0; r < rows; r++)
    {
      for (int c = 0; c < resultColumns; c++)
 
      {
        result[r][c] = array[z++];
        if (z >= arrayLength)
         {
          z = 0;
         }
       }
      }
 
    return result;
  }
}

the java out put is : [[6,6],[3,3],[9,9],[0,0]],[[[6,6],[3,3],[9,9],[0,0]]
************************************************** ******************************

it does not produce a copy array format as repmat() in matlab.


please any suggestion.
AnswerRe: Produce repmat() method using java Pin
Richard MacCutchan15-May-16 20:56
mveRichard MacCutchan15-May-16 20:56 
QuestionSend Mail From Lotus Notes 9 Pin
Member 1252399114-May-16 17:19
Member 1252399114-May-16 17:19 
Questionglassfish alternatedocroot [moved to web development] Pin
V.12-May-16 22:02
professionalV.12-May-16 22:02 
GeneralRe: glassfish alternatedocroot Pin
Richard MacCutchan12-May-16 23:17
mveRichard MacCutchan12-May-16 23:17 
GeneralRe: glassfish alternatedocroot Pin
V.12-May-16 23:21
professionalV.12-May-16 23:21 
GeneralRe: glassfish alternatedocroot Pin
Richard MacCutchan12-May-16 23:24
mveRichard MacCutchan12-May-16 23:24 
QuestionThe problem about java multiple inheritance Pin
tzungshian6-May-16 20:20
tzungshian6-May-16 20:20 
AnswerRe: The problem about java multiple inheritance Pin
Richard MacCutchan6-May-16 22:47
mveRichard MacCutchan6-May-16 22:47 
GeneralRe: The problem about java multiple inheritance Pin
tzungshian7-May-16 0:34
tzungshian7-May-16 0:34 
QuestionJava program Pin
Member 123753736-May-16 0:54
Member 123753736-May-16 0:54 
AnswerRe: Java program Pin
Richard MacCutchan6-May-16 2:58
mveRichard MacCutchan6-May-16 2:58 
QuestionHow do I catch an exception in a future event handler? Pin
williamj485-May-16 3:09
williamj485-May-16 3:09 
QuestionSwing & Threading Help Please Pin
PCGuyIV3-May-16 5:28
professionalPCGuyIV3-May-16 5:28 
AnswerRe: Swing & Threading Help Please Pin
Richard MacCutchan4-May-16 1:37
mveRichard MacCutchan4-May-16 1:37 
Questionabout java discussion Pin
Ankit Raut24-Apr-16 4:52
Ankit Raut24-Apr-16 4:52 
AnswerRe: about java discussion Pin
Richard MacCutchan24-Apr-16 5:50
mveRichard MacCutchan24-Apr-16 5:50 
Questioni have my assignment code in java but i try to run it and its giving me some error that have to fix can you help Pin
Member 1247519320-Apr-16 22:30
Member 1247519320-Apr-16 22:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.